Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-webapps gulp option #9622

Merged
merged 3 commits into from
Aug 7, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const isWin32 = os.platform() === "win32";

const clean = () => rimraf("built").then(() => rimraf("temp"));
const update = () => exec("git pull", true).then(() => exec("npm install", true))

const noop = () => Promise.resolve();

/** onlineline */
const onlinelearning = () => {
Expand Down Expand Up @@ -653,6 +653,26 @@ const copyMultiplayerHtml = () => rimraf("webapp/public/multiplayer.html")

const multiplayer = gulp.series(cleanMultiplayer, buildMultiplayer, gulp.series(copyMultiplayerCss, copyMultiplayerJs, copyMultiplayerHtml));

/********************************************************
Webapp build wrappers
*********************************************************/

const shouldBuildWebapps = () => (process.argv.indexOf("--no-webapps") === -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit; making this an async function would remove the need for an explicit returned noop / inverted logic, but fine either way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something we could improve later for sure. Gulp's expectations here are very specific and I wrestled with it more than I'd expected to.


const maybeUpdateWebappStrings = () => {
if (!shouldBuildWebapps()) return noop;
return gulp.parallel(
updateSkillMapStrings,
updateAuthcodeStrings,
updateMultiplayerStrings,
);
};

const maybeBuildWebapps = () => {
if (!shouldBuildWebapps()) return noop;
return gulp.parallel(skillmap, authcode, multiplayer);
}

/********************************************************
Tests and Linting
*********************************************************/
Expand Down Expand Up @@ -739,12 +759,8 @@ function testTask(testFolder, testFile) {
}

const buildAll = gulp.series(
gulp.parallel(
updatestrings,
updateSkillMapStrings,
updateAuthcodeStrings,
updateMultiplayerStrings,
),
updatestrings,
maybeUpdateWebappStrings(),
copyTypescriptServices,
copyBlocklyTypings,
gulp.parallel(pxtlib, pxtweb),
Expand All @@ -756,7 +772,7 @@ const buildAll = gulp.series(
targetjs,
reactCommon,
gulp.parallel(buildcss, buildSVGIcons),
gulp.parallel(skillmap, authcode, multiplayer),
maybeBuildWebapps(),
webapp,
browserifyWebapp,
browserifyAssetEditor,
Expand Down
Loading