1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Add more info to Extensions list (#18391)

Co-authored-by: @Gudahtt
This commit is contained in:
HowardBraham 2023-04-06 14:37:55 -04:00 committed by GitHub
parent c8d054a385
commit 54fa7808c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 2 deletions

View File

@ -147,6 +147,9 @@ async function defineAndRunBuildTasks() {
browserPlatforms,
browserVersionMap,
buildType,
applyLavaMoat,
shouldIncludeSnow,
entryTask,
});
const styleTasks = createStyleTasks({ livereload });

View File

@ -1,14 +1,16 @@
const { promises: fs } = require('fs');
const path = require('path');
const { mergeWith, cloneDeep } = require('lodash');
const childProcess = require('child_process');
const { mergeWith, cloneDeep, capitalize } = require('lodash');
const baseManifest = process.env.ENABLE_MV3
? require('../../app/manifest/v3/_base.json')
: require('../../app/manifest/v2/_base.json');
const { BuildType } = require('../lib/build-type');
const { TASKS } = require('./constants');
const { TASKS, ENVIRONMENT } = require('./constants');
const { createTask, composeSeries } = require('./task');
const { getEnvironment } = require('./utils');
module.exports = createManifestTasks;
@ -16,6 +18,9 @@ function createManifestTasks({
browserPlatforms,
browserVersionMap,
buildType,
applyLavaMoat,
shouldIncludeSnow,
entryTask,
}) {
// merge base manifest with per-platform manifests
const prepPlatforms = async () => {
@ -38,6 +43,9 @@ function createManifestTasks({
await getBuildModifications(buildType, platform),
customArrayMerge,
);
modifyNameAndDescForNonProd(result);
const dir = path.join('.', 'dist', platform);
await fs.mkdir(dir, { recursive: true });
await writeJson(result, path.join(dir, 'manifest.json'));
@ -101,12 +109,39 @@ function createManifestTasks({
);
const manifest = await readJson(manifestPath);
transformFn(manifest);
await writeJson(manifest, manifestPath);
}),
);
};
}
// For non-production builds only, modify the extension's name and description
function modifyNameAndDescForNonProd(manifest) {
const environment = getEnvironment({ buildTarget: entryTask });
if (environment === ENVIRONMENT.PRODUCTION) {
return;
}
const mv3Str = process.env.ENABLE_MV3 ? ' MV3' : '';
const lavamoatStr = applyLavaMoat ? ' lavamoat' : '';
const snowStr = shouldIncludeSnow ? ' snow' : '';
// Get the first 8 characters of the git revision id
const gitRevisionStr = childProcess
.execSync('git rev-parse HEAD')
.toString()
.trim()
.substring(0, 8);
manifest.name = `MetaMask ${capitalize(
buildType,
)}${mv3Str}${lavamoatStr}${snowStr}`;
manifest.description = `${environment} build from git id: ${gitRevisionStr}`;
}
// helper for merging obj value
function customArrayMerge(objValue, srcValue) {
if (Array.isArray(objValue)) {

View File

@ -10,6 +10,7 @@
"start": "yarn build:dev dev --apply-lavamoat=false --snow=false",
"start:lavamoat": "yarn build:dev dev --apply-lavamoat=true",
"start:mv3": "ENABLE_MV3=true yarn build:dev dev --apply-lavamoat=false",
"start:flask": "yarn start --build-type flask",
"dist": "yarn build dist",
"build": "yarn lavamoat:build",
"build:dev": "node development/build/index.js",