diff --git a/package-lock.json b/package-lock.json index dd429cc7..813bff86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1810,9 +1810,9 @@ "dev": true }, "deepmerge": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.2.1.tgz", - "integrity": "sha512-+hbDSzTqEW0fWgnlKksg7XAOtT+ddZS5lHZJ6f6MdixRs9wQy+50fm1uUCVb1IkvjLUYX/SfFO021ZNwriURTw==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", "dev": true }, "default-require-extensions": { diff --git a/package.json b/package.json index b3ea23cb..e3cd65e1 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "archiver-promise": "~1.0", "chalk": "~2.4", "conventional-changelog-moulded-angular": "github:matatk/conventional-changelog-moulded-angular#0.2.0", - "deepmerge": "~3.2", + "deepmerge": "~4.2", "eslint": "~5.16", "fs-extra": "~7.0", "husky": "~1.3", diff --git a/scripts/build.js b/scripts/build.js index f2270bd9..91b23934 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -367,23 +367,16 @@ function mergeManifest(browser) { const commonJson = require(common) const extraJson = require(extra) - // For pre-2.0.0 deepmerge behaviour... - // https://github.com/KyleAMathews/deepmerge#examples (and scroll a bit) - const emptyTarget = value => Array.isArray(value) ? [] : {} - const clone = (value, options) => merge(emptyTarget(value), value, options) - - function legacyArrayMerge(target, source, options) { + function combineMerge(target, source, options) { const destination = target.slice() - source.forEach(function(e, i) { - if (typeof destination[i] === 'undefined') { - const cloneRequested = options.clone !== false - const shouldClone = cloneRequested && options.isMergeableObject(e) - destination[i] = shouldClone ? clone(e, options) : e - } else if (options.isMergeableObject(e)) { - destination[i] = merge(target[i], e, options) - } else if (target.indexOf(e) === -1) { - destination.push(e) + source.forEach((item, index) => { + if (typeof destination[index] === 'undefined') { + destination[index] = options.cloneUnlessOtherwiseSpecified(item, options) + } else if (options.isMergeableObject(item)) { + destination[index] = merge(target[index], item, options) + } else if (target.indexOf(item) === -1) { + destination.push(item) } }) return destination @@ -391,7 +384,7 @@ function mergeManifest(browser) { // Merging this way 'round just happens to make it so that, when merging // the arrays of scripts to include, the compatibility one comes first. - const merged = merge(extraJson, commonJson, { arrayMerge: legacyArrayMerge }) + const merged = merge(extraJson, commonJson, { arrayMerge: combineMerge }) merged.version = extVersion fs.writeFileSync( path.join(pathToBuild(browser), 'manifest.json'),