diff --git a/development/build/scripts.js b/development/build/scripts.js index e1a3a0551..fd73a62af 100644 --- a/development/build/scripts.js +++ b/development/build/scripts.js @@ -248,6 +248,7 @@ function createScriptTasks({ phishingDetectSubtask, ].map((subtask) => runInChildProcess(subtask, { + applyLavaMoat, buildType, isLavaMoat, policyOnly, diff --git a/development/build/task.js b/development/build/task.js index 316020259..26df8bf85 100644 --- a/development/build/task.js +++ b/development/build/task.js @@ -50,7 +50,7 @@ function createTask(taskName, taskFn) { function runInChildProcess( task, - { buildType, isLavaMoat, policyOnly, shouldLintFenceFiles }, + { applyLavaMoat, buildType, isLavaMoat, policyOnly, shouldLintFenceFiles }, ) { const taskName = typeof task === 'string' ? task : task.taskName; if (!taskName) { @@ -60,44 +60,23 @@ function runInChildProcess( } return instrumentForTaskStats(taskName, async () => { - let childProcess; - // Use the same build type for subprocesses, and only run them in LavaMoat - // if the parent process also ran in LavaMoat. - if (isLavaMoat) { - childProcess = spawn( - 'yarn', - [ - 'build', - taskName, - '--build-type', - buildType, - '--lint-fence-files', - shouldLintFenceFiles, - '--skip-stats', - ...(policyOnly ? ['--policy-only'] : []), - ], - { - env: process.env, - }, - ); - } else { - childProcess = spawn( - 'yarn', - [ - 'build:dev', - taskName, - '--build-type', - buildType, - '--lint-fence-files', - shouldLintFenceFiles, - '--skip-stats', - ...(policyOnly ? ['--policy-only'] : []), - ], - { - env: process.env, - }, - ); - } + const childProcess = spawn( + 'yarn', + [ + // Use the same build type for subprocesses, and only run them in + // LavaMoat if the parent process also ran in LavaMoat. + isLavaMoat ? 'build' : 'build:dev', + taskName, + `--apply-lavamoat=${applyLavaMoat ? 'true' : 'false'}`, + `--build-type=${buildType}`, + `--lint-fence-files=${shouldLintFenceFiles ? 'true' : 'false'}`, + `--policyOnly=${policyOnly ? 'true' : 'false'}`, + '--skip-stats=true', + ], + { + env: process.env, + }, + ); // forward logs to main process // skip the first stdout event (announcing the process command) diff --git a/package.json b/package.json index 761761f13..566830760 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "scripts": { "setup": "yarn install && yarn setup:postinstall", "setup:postinstall": "yarn patch-package && yarn allow-scripts", - "start": "yarn build:dev --apply-lavamoat=false", - "start:lavamoat": "yarn build:dev --apply-lavamoat=true", + "start": "yarn build:dev dev --apply-lavamoat=false", + "start:lavamoat": "yarn build:dev dev --apply-lavamoat=true", "dist": "yarn build prod", "build": "yarn lavamoat:build", - "build:dev": "node development/build/index.js dev", + "build:dev": "node development/build/index.js", "start:test": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' yarn build testDev", "benchmark:chrome": "SELENIUM_BROWSER=chrome node test/e2e/benchmark.js", "benchmark:firefox": "SELENIUM_BROWSER=firefox node test/e2e/benchmark.js",