From 7dac6f2517828538330d7020981ab455543e3cf0 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 7 Dec 2021 12:31:01 -1000 Subject: [PATCH] Fix browser specific manifest generation (#13007) --- development/build/manifest.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/development/build/manifest.js b/development/build/manifest.js index a87fd53de..524f2ef3b 100644 --- a/development/build/manifest.js +++ b/development/build/manifest.js @@ -1,6 +1,6 @@ const { promises: fs } = require('fs'); const path = require('path'); -const { merge, cloneDeep } = require('lodash'); +const { mergeWith, cloneDeep } = require('lodash'); const baseManifest = require('../../app/manifest/_base.json'); @@ -28,11 +28,12 @@ function createManifestTasks({ `${platform}.json`, ), ); - const result = merge( + const result = mergeWith( cloneDeep(baseManifest), platformModifications, browserVersionMap[platform], await getBuildModifications(buildType, platform), + customArrayMerge, ); const dir = path.join('.', 'dist', platform); await fs.mkdir(dir, { recursive: true }); @@ -99,6 +100,14 @@ function createManifestTasks({ ); }; } + + // helper for merging obj value + function customArrayMerge(objValue, srcValue) { + if (Array.isArray(objValue)) { + return [...new Set([...objValue, ...srcValue])]; + } + return undefined; + } } // helper for reading and deserializing json from fs