fix(build): Have prepare task signal async completion (#6356)

PR #6244 made a change to have the npm run prepare script
(automatically invoked by npm install after package installation)
not bother running the buildJavaScriptAndDeps gulp task when run
from a GitHub action (since our build action will do npm test
straight afterwards, which runs this task already).

Unfortunately, due my misunderstanding of how gulp tasks work
the revised version generated a "Did you forget to signal async
completion?" error from gulp.

Fix this by adding a done parameter and passing the provided
callback to buildJavaScriptAndDeps.  This also allows a
simplification of the the don't-run case by simply calling
done and then returning.
This commit is contained in:
Christopher Allen
2022-08-22 22:27:26 +01:00
committed by GitHub
parent 43f54b1b06
commit 079699baff

View File

@@ -295,11 +295,12 @@ var JSCOMP_OFF = [
* needed, and we don't want to, because a tsc error would prevent
* other workflows (like lint and format) from completing.
*/
function prepare() {
function prepare(done) {
if (process.env.CI) {
return gulp.src('.'); // Do nothing.
done();
return;
}
return buildJavaScriptAndDeps();
return buildJavaScriptAndDeps(done);
}
const buildJavaScriptAndDeps = gulp.series(buildJavaScript, buildDeps);