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

[LavaMoat] improve policy generation performance in dev workflow (#16338)

* npm scripts - rename lavamoat:background to lavamoat:webapp

* lavamoat - generate webapp policy - add devMode flag to run in node for speed

* lavamoat - generate webapp policy - dont lint fences

* lint fix
This commit is contained in:
kumavis 2022-11-01 08:52:38 -10:00 committed by GitHub
parent d8372500cf
commit 9a74c995bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 6 deletions

View File

@ -11,7 +11,7 @@ start().catch((error) => {
async function start() {
const {
argv: { buildTypes, parallel },
argv: { buildTypes, parallel, devMode },
} = yargs(hideBin(process.argv)).usage(
'$0 [options]',
'Generate the LavaMoat policy file for one more more build types.',
@ -31,13 +31,22 @@ async function start() {
description: 'Whether to generate policies in parallel.',
type: 'boolean',
})
.option('devMode', {
alias: ['d'],
default: false,
demandOption: true,
description:
'Whether to run the process under lavamoat (devMode=false) or node (devMode=true)',
type: 'boolean',
})
.strict(),
);
const buildCommand = devMode ? 'build:dev' : 'build';
await concurrently(
(Array.isArray(buildTypes) ? buildTypes : [buildTypes]).map(
(buildType) => ({
command: `yarn build scripts:dist --policy-only --build-type=${buildType}`,
command: `yarn ${buildCommand} scripts:dist --policy-only --lint-fence-files=false --build-type=${buildType}`,
env: {
WRITE_AUTO_POLICY: 1,
},

View File

@ -73,10 +73,10 @@
"lavamoat:build": "lavamoat development/build/index.js --policy lavamoat/build-system/policy.json --policyOverride lavamoat/build-system/policy-override.json",
"lavamoat:build:auto": "yarn lavamoat:build --writeAutoPolicy",
"lavamoat:debug:build": "yarn lavamoat:build --writeAutoPolicyDebug --policydebug lavamoat/build-system/policy-debug.json",
"lavamoat:background:auto": "node ./development/generate-lavamoat-policies.js",
"lavamoat:background:auto:ci": "node ./development/generate-lavamoat-policies.js --parallel=false",
"lavamoat:auto": "yarn lavamoat:build:auto && yarn lavamoat:background:auto",
"lavamoat:auto:ci": "yarn lavamoat:build:auto && yarn lavamoat:background:auto:ci",
"lavamoat:webapp:auto": "node ./development/generate-lavamoat-policies.js --devMode=true",
"lavamoat:webapp:auto:ci": "node ./development/generate-lavamoat-policies.js --parallel=false",
"lavamoat:auto": "yarn lavamoat:build:auto && yarn lavamoat:webapp:auto",
"lavamoat:auto:ci": "yarn lavamoat:build:auto && yarn lavamoat:webapp:auto:ci",
"ts-migration:enumerate": "ts-node development/ts-migration-dashboard/scripts/write-list-of-files-to-convert.ts",
"ts-migration:dashboard:watch": "ts-node development/ts-migration-dashboard/scripts/build.ts --watch",
"ts-migration:dashboard:build": "ts-node development/ts-migration-dashboard/scripts/build.ts",