From e3c04978f3bd18581c156f35cf406857a74ec955 Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Thu, 8 Dec 2022 16:32:25 +0000 Subject: [PATCH] chore(build): Remove prepare script; run deps script from start script (#6653) To make `npm install` and `npm ci` faster, and to avoid redundant work when doing either of these followed by `npm run build` (or any other script which does a build), delete the `prepare` script and instead add an invocation of `npm run deps` to the beginning of the `start` script. --- gulpfile.js | 1 - package.json | 3 +-- scripts/gulpfiles/build_tasks.js | 20 -------------------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 80afbd800..e2e41762f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -41,7 +41,6 @@ module.exports = { gitUpdateGithubPages: gitTasks.updateGithubPages, // Manually-invokable targets, with prequisites where required. - prepare: buildTasks.prepare, format: buildTasks.format, messages: buildTasks.messages, // Generate msg/json/en.json et al. sortRequires: cleanupTasks.sortRequires, diff --git a/package.json b/package.json index bdb12f251..aabe95be4 100644 --- a/package.json +++ b/package.json @@ -44,13 +44,12 @@ "minify": "gulp minify", "package": "gulp package", "postinstall": "patch-package", - "prepare": "gulp prepare", "prepareDemos": "gulp prepareDemos", "publish": "npm ci && gulp publish", "publish:beta": "npm ci && gulp publishBeta", "recompile": "gulp recompile", "release": "gulp gitCreateRC", - "start": "concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", + "start": "npm run deps && concurrently -n tsc,server \"tsc --watch --preserveWatchOutput --outDir 'build/src' --declarationDir 'build/declarations'\" \"http-server ./ -s -o /tests/playground.html -c-1\"", "tsc": "gulp tsc", "test": "gulp test", "test:generators": "gulp testGenerators", diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js index 4358ad8e5..9e8ab31ae 100644 --- a/scripts/gulpfiles/build_tasks.js +++ b/scripts/gulpfiles/build_tasks.js @@ -288,25 +288,6 @@ const JSCOMP_OFF = [ 'visibility', ]; -/** - * The npm prepare script, run by npm install after installing modules - * and as part of the packaging process. - * - * This does just enough of the build that npm start should work. - * - * Exception: when running in the CI environment, we don't build - * anything. We don't need to, because npm test will build everything - * needed, and we don't want to, because a tsc error would prevent - * other workflows (like lint and format) from completing. - */ -function prepare(done) { - if (process.env.CI) { - done(); - return; - } - return exports.deps(done); -} - /** * Builds Blockly as a JS program, by running tsc on all the files in * the core directory. @@ -760,7 +741,6 @@ exports.minify = gulp.series(exports.deps, buildCompiled); exports.build = gulp.parallel(exports.minify, exports.langfiles); // Manually-invokable targets, with prequisites where required. -exports.prepare = prepare; exports.format = format; exports.messages = generateMessages; // Generate msg/json/en.json et al. exports.buildAdvancedCompilationTest =