Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/stencil-pull.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,19 @@ utils.mergeThemeConfiguration = async (options) => {
continue;
}
const defaultVal = localConfig.settings[key];
// Compare against the variation override (when present) so stale ones get cleared.
const effectiveLocalVal = _.has(variation.settings, key)
? variation.settings[key]
: defaultVal;
// Check for different types, and throw an error if they are found
if (typeof defaultVal !== typeof remoteVal) {
if (typeof effectiveLocalVal !== typeof remoteVal) {
throw new Error(
`Theme configuration key "${key}" cannot be merged because it is not of the same type. ` +
`Remote configuration is of type ${typeof remoteVal} while local configuration is of type ${typeof defaultVal}.`,
`Remote configuration is of type ${typeof remoteVal} while local configuration is of type ${typeof effectiveLocalVal}.`,
);
}
// If a different value is found, overwrite the local config
if (!_.isEqual(defaultVal, remoteVal)) {
if (!_.isEqual(effectiveLocalVal, remoteVal)) {
if (!variation.settings) {
variation.settings = {};
}
Expand Down
Loading