1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix browser specific manifest generation (#13007)

This commit is contained in:
kumavis 2021-12-07 12:31:01 -10:00 committed by GitHub
parent 1794ee8b72
commit 7dac6f2517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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