From 5babb235faa79f2592092d43992285ecdf9f2a3a Mon Sep 17 00:00:00 2001 From: lizschwab Date: Wed, 23 Sep 2026 09:57:49 -0700 Subject: [PATCH 1/5] chore: move tsc command off gulp --- packages/blockly/gulpfile.mjs | 2 -- packages/blockly/package.json | 6 ++-- packages/blockly/scripts/build_constants.mjs | 30 +++++++++++++++++++ .../blockly/scripts/gulpfiles/build_tasks.mjs | 15 ---------- packages/blockly/scripts/tsc.mjs | 17 +++++++++++ 5 files changed, 50 insertions(+), 20 deletions(-) create mode 100644 packages/blockly/scripts/build_constants.mjs create mode 100644 packages/blockly/scripts/tsc.mjs diff --git a/packages/blockly/gulpfile.mjs b/packages/blockly/gulpfile.mjs index f3e893444cc..bb5ab244b5c 100644 --- a/packages/blockly/gulpfile.mjs +++ b/packages/blockly/gulpfile.mjs @@ -28,7 +28,6 @@ import { langfiles, messages, minify, - tsc, } from './scripts/gulpfiles/build_tasks.mjs'; import {cleanBuildDir, cleanReleaseDir} from './scripts/lib/fs_utils.mjs'; @@ -44,7 +43,6 @@ export default build; // prettier-ignore export { langfiles, - tsc, minify, build, prepareDemos, diff --git a/packages/blockly/package.json b/packages/blockly/package.json index f655fb024c7..af5266f12d2 100644 --- a/packages/blockly/package.json +++ b/packages/blockly/package.json @@ -94,7 +94,7 @@ } }, "scripts": { - "build": "gulp build", + "build": "npm run tsc && gulp build", "build-debug": "gulp build --verbose --debug", "build-debug-log": "npm run build:debug > build-debug.log 2>&1 && tail -3 build-debug.log", "build-strict": "gulp build --verbose --strict", @@ -112,14 +112,14 @@ "start": "npm run package && nx run @blockly/dev-tools:build && node \"scripts/prepare_advanced_playground.mjs\" && concurrently -n devtools-watch,blockly-watch,server \"nx watch --projects=@blockly/dev-tools --includeDependencies -- nx run rebuildAdvancedPlayground\" \"nx watch --projects=blockly -- nx run rebuildBlockly\" \"http-server ./ -s -o /tests/playground.html -c-1\"", "rebuildAdvancedPlayground": "npm run build --workspace=@blockly/dev-tools && node \"scripts/prepare_advanced_playground.mjs\"", "rebuildBlockly": "npm run build && node \"scripts/prepare_advanced_playground.mjs\"", - "tsc": "gulp tsc", + "tsc": "node \"scripts/tsc.mjs\"", "test": "nx run-many -p blockly --targets=lint,test-renamings,test-mocha-node,test-generators,test-type-definitions,test-compile-advanced,test-compile-advanced-browser", "test-browser": "npx nx run @blockly/block-test:build && npx mocha --config tests/browser/.mocharc.js", "test-mocha-node": "npm run test-mocha-typecheck && npx mocha --config tests/mocha/.mocharc.node.cjs \"tests/mocha/**/*_test.{js,ts}\"", "test-mocha-typecheck": "tsc -p tests/mocha/tsconfig.json", "test-generators": "node \"tests/generators/test_generators.mjs\"", "test-mocha-interactive": "npm run build && node scripts/prepare_mocha_bundle.mjs && concurrently -n tsc,tsc:tests,esbuild,python3 \"tsc --watch --preserveWatchOutput --outDir \"build/src\" --declarationDir \"build/declarations\"\" \"npm run test-mocha-typecheck -- --watch --preserveWatchOutput\" \"esbuild build/tests/bundle-entry.js --bundle --sourcemap --alias:blockly/core=./build/src/core/blockly.js --alias:blockly/blocks=./build/src/blocks/blocks.js --alias:blockly=./build/src/core/blockly.js --outfile=build/tests/mocha-bundle.js --servedir=. --serve=127.0.0.1:8080 --watch=forever --log-level=warning\" \"python3 -m webbrowser 'http://localhost:8080/tests/mocha/index.html'\"", - "test-compile-advanced": "gulp buildAdvancedCompilationTest --debug", + "test-compile-advanced": "npm run tsc && gulp buildAdvancedCompilationTest --debug", "test-compile-advanced-browser": "node \"tests/compile/webdriver.js\"", "test-renamings": "node \"tests/migration/validate-renamings.mjs\"", "test-type-definitions": "tsc -p ./tests/typescript/tsconfig.json -outDir \"build/src\"", diff --git a/packages/blockly/scripts/build_constants.mjs b/packages/blockly/scripts/build_constants.mjs new file mode 100644 index 00000000000..43a5def353f --- /dev/null +++ b/packages/blockly/scripts/build_constants.mjs @@ -0,0 +1,30 @@ +import * as path from 'path'; + +// Paths are all relative to the repository root. Do not include +// trailing slash. +// +// TODO(#5007): If you modify these values, you must also modify the +// corresponding values in the following files: +// +// - tests/scripts/check_metadata.sh +// - tests/scripts/update_metadata.sh + +// Directory to write compiled output to. +export const BUILD_DIR = 'build'; + +// Directory to write typings output to. +export const TYPINGS_BUILD_DIR = path.join(BUILD_DIR, 'declarations'); + +// Directory to write langfile output to. +export const LANG_BUILD_DIR = path.join(BUILD_DIR, 'msg'); + +// Directory where typescript compiler output can be found. +// Matches the value in tsconfig.json: outDir +export const TSC_OUTPUT_DIR = path.join(BUILD_DIR, 'src'); + +// Directory for files generated by compiling test code. +export const TEST_TSC_OUTPUT_DIR = path.join(BUILD_DIR, 'tests'); + +// Directory in which to assemble (and from which to publish) the +// blockly npm package. +export const RELEASE_DIR = 'dist'; \ No newline at end of file diff --git a/packages/blockly/scripts/gulpfiles/build_tasks.mjs b/packages/blockly/scripts/gulpfiles/build_tasks.mjs index f8b6aabec11..ad3c798aa0b 100644 --- a/packages/blockly/scripts/gulpfiles/build_tasks.mjs +++ b/packages/blockly/scripts/gulpfiles/build_tasks.mjs @@ -331,19 +331,6 @@ const JSCOMP_OFF = [ 'visibility', ]; -/** - * Builds Blockly as a JS program, by running tsc on all the files in - * the core directory. - */ -export function tsc(done) { - execSync( - `tsc -outDir "${TSC_OUTPUT_DIR}" -declarationDir "${TYPINGS_BUILD_DIR}"`, - {stdio: 'inherit'}, - ); - execSync(`node scripts/tsick.js "${TSC_OUTPUT_DIR}"`, {stdio: 'inherit'}); - done(); -} - /** * This task regenerates msg/json/en.js and msg/json/qqq.js from * msg/messages.js. @@ -880,7 +867,6 @@ function compileAdvancedCompilationTest() { export const langfiles = gulp.parallel(buildLangfiles, buildLangfileShims); // function tsc, above export const minify = gulp.series( - tsc, buildChunkExporters, buildCompiled, buildShims, @@ -890,6 +876,5 @@ export const build = gulp.parallel(minify, langfiles); // Manually-invokable targets, with prerequisites where required. // function messages, above export const buildAdvancedCompilationTest = gulp.series( - tsc, compileAdvancedCompilationTest, ); diff --git a/packages/blockly/scripts/tsc.mjs b/packages/blockly/scripts/tsc.mjs new file mode 100644 index 00000000000..e6731c88135 --- /dev/null +++ b/packages/blockly/scripts/tsc.mjs @@ -0,0 +1,17 @@ +import {execSync} from 'child_process'; + +import {TSC_OUTPUT_DIR, TYPINGS_BUILD_DIR} from './build_constants.mjs'; + +/** + * Builds Blockly as a JS program, by running tsc on all the files in + * the core directory. + */ +function tsc() { + execSync( + `npx tsc -outDir "${TSC_OUTPUT_DIR}" -declarationDir "${TYPINGS_BUILD_DIR}"`, + {stdio: 'inherit'}, + ); + execSync(`node scripts/tsick.js "${TSC_OUTPUT_DIR}"`, {stdio: 'inherit'}); +} + +tsc(); From 4c697227be2cc7ceda4b465bacc8c2e1af7c672a Mon Sep 17 00:00:00 2001 From: lizschwab Date: Wed, 23 Sep 2026 10:25:12 -0700 Subject: [PATCH 2/5] chore: formatting --- packages/blockly/scripts/build_constants.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/blockly/scripts/build_constants.mjs b/packages/blockly/scripts/build_constants.mjs index 43a5def353f..f54900626fa 100644 --- a/packages/blockly/scripts/build_constants.mjs +++ b/packages/blockly/scripts/build_constants.mjs @@ -27,4 +27,4 @@ export const TEST_TSC_OUTPUT_DIR = path.join(BUILD_DIR, 'tests'); // Directory in which to assemble (and from which to publish) the // blockly npm package. -export const RELEASE_DIR = 'dist'; \ No newline at end of file +export const RELEASE_DIR = 'dist'; From 5c6dfe69a67b1598019e12f4876fb3b62c12d6ec Mon Sep 17 00:00:00 2001 From: lizschwab Date: Wed, 23 Sep 2026 11:19:43 -0700 Subject: [PATCH 3/5] chore: remove unused reference --- packages/blockly/scripts/gulpfiles/build_tasks.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/blockly/scripts/gulpfiles/build_tasks.mjs b/packages/blockly/scripts/gulpfiles/build_tasks.mjs index ad3c798aa0b..33e3c1eadc4 100644 --- a/packages/blockly/scripts/gulpfiles/build_tasks.mjs +++ b/packages/blockly/scripts/gulpfiles/build_tasks.mjs @@ -28,7 +28,6 @@ import { LANG_BUILD_DIR, RELEASE_DIR, TSC_OUTPUT_DIR, - TYPINGS_BUILD_DIR, } from './config.mjs'; import {posixPath, quote} from '../helpers.js'; From e5751baa45842d558722c39641aa74cbfbd9c890 Mon Sep 17 00:00:00 2001 From: lizschwab Date: Wed, 23 Sep 2026 15:22:47 -0700 Subject: [PATCH 4/5] chore: move langfiles and messages off gulp --- packages/blockly/gulpfile.mjs | 4 - packages/blockly/package.json | 6 +- packages/blockly/scripts/build_constants.mjs | 7 + .../blockly/scripts/gulpfiles/build_tasks.mjs | 124 +----------------- packages/blockly/scripts/langfiles.mjs | 104 +++++++++++++++ packages/blockly/scripts/messages.mjs | 44 +++++++ 6 files changed, 159 insertions(+), 130 deletions(-) create mode 100644 packages/blockly/scripts/langfiles.mjs create mode 100644 packages/blockly/scripts/messages.mjs diff --git a/packages/blockly/gulpfile.mjs b/packages/blockly/gulpfile.mjs index bb5ab244b5c..586e73be89e 100644 --- a/packages/blockly/gulpfile.mjs +++ b/packages/blockly/gulpfile.mjs @@ -25,8 +25,6 @@ import { import { build, buildAdvancedCompilationTest, - langfiles, - messages, minify, } from './scripts/gulpfiles/build_tasks.mjs'; import {cleanBuildDir, cleanReleaseDir} from './scripts/lib/fs_utils.mjs'; @@ -42,7 +40,6 @@ export default build; // // prettier-ignore export { - langfiles, minify, build, prepareDemos, @@ -55,7 +52,6 @@ export { // // prettier-ignore export { - messages, // Generate msg/json/en.json et al. clean, buildAdvancedCompilationTest, } diff --git a/packages/blockly/package.json b/packages/blockly/package.json index 2c849a97432..861eaecf5e7 100644 --- a/packages/blockly/package.json +++ b/packages/blockly/package.json @@ -94,7 +94,7 @@ } }, "scripts": { - "build": "npm run tsc && gulp build", + "build": "npm run tsc && gulp build && npm run langfiles", "build-debug": "gulp build --verbose --debug", "build-debug-log": "npm run build:debug > build-debug.log 2>&1 && tail -3 build-debug.log", "build-strict": "gulp build --verbose --strict", @@ -102,10 +102,10 @@ "clean": "gulp clean", "deployDemos": "npm ci && gulp deployDemos", "deployDemos:beta": "npm ci && gulp deployDemosBeta", - "messages": "gulp messages", + "messages": "node \"scripts/messages.mjs\"", "lint": "eslint .", "lint-fix": "eslint . --fix", - "langfiles": "gulp langfiles", + "langfiles": "node \"scripts/langfiles.mjs\"", "minify": "gulp minify", "package": "node scripts/package.mjs", "prepareDemos": "gulp prepareDemos", diff --git a/packages/blockly/scripts/build_constants.mjs b/packages/blockly/scripts/build_constants.mjs index f54900626fa..1b2ae1339f0 100644 --- a/packages/blockly/scripts/build_constants.mjs +++ b/packages/blockly/scripts/build_constants.mjs @@ -28,3 +28,10 @@ export const TEST_TSC_OUTPUT_DIR = path.join(BUILD_DIR, 'tests'); // Directory in which to assemble (and from which to publish) the // blockly npm package. export const RELEASE_DIR = 'dist'; + +/** + * Path to the python runtime. + * This will normalize the command across platforms (e.g. python3 on Linux and + * Mac, python on Windows). + */ +export const PYTHON = process.platform === 'win32' ? 'python' : 'python3'; diff --git a/packages/blockly/scripts/gulpfiles/build_tasks.mjs b/packages/blockly/scripts/gulpfiles/build_tasks.mjs index 33e3c1eadc4..1f35db6e387 100644 --- a/packages/blockly/scripts/gulpfiles/build_tasks.mjs +++ b/packages/blockly/scripts/gulpfiles/build_tasks.mjs @@ -13,7 +13,6 @@ import rename from 'gulp-rename'; import replace from 'gulp-replace'; import sourcemaps from 'gulp-sourcemaps'; -import {execSync} from 'child_process'; import * as fs from 'fs'; import * as fsPromises from 'fs/promises'; import * as path from 'path'; @@ -25,7 +24,6 @@ import {hideBin} from 'yargs/helpers'; import { BUILD_DIR, - LANG_BUILD_DIR, RELEASE_DIR, TSC_OUTPUT_DIR, } from './config.mjs'; @@ -39,13 +37,6 @@ const argv = yargs(hideBin(process.argv)).parse(); // Build // //////////////////////////////////////////////////////////// -/** - * Path to the python runtime. - * This will normalize the command across platforms (e.g. python3 on Linux and - * Mac, python on Windows). - */ -const PYTHON = process.platform === 'win32' ? 'python' : 'python3'; - /** * Posix version of TSC_OUTPUT_DIR */ @@ -330,80 +321,6 @@ const JSCOMP_OFF = [ 'visibility', ]; -/** - * This task regenerates msg/json/en.js and msg/json/qqq.js from - * msg/messages.js. - */ -export function messages(done) { - // Run js_to_json.py - const jsToJsonCmd = `${PYTHON} scripts/i18n/js_to_json.py \ - --input_file ${path.join('msg', 'messages.js')} \ - --output_dir ${path.join('msg', 'json')} \ - --quiet`; - execSync(jsToJsonCmd, {stdio: 'inherit'}); - - console.log(` -Regenerated several flies in msg/json/. Now run - - git diff msg/json/*.json - -and check that operation has not overwritten any modifications made to -hints, etc. by the TranslateWiki volunteers. If it has, backport -their changes to msg/messages.js and re-run 'npm run messages'. - -Once you are satisfied that any new hints have been backported you may -go ahead and commit the changes, but note that the messages script -will have removed the translator credits - be careful not to commit -this removal! -`); - - done(); -} - -var languages = null; - -/** - * Get list of languages to build langfiles and/or shims for, based on .json - * files in msg/json/, skipping certain entries that do not correspond to an - * actual language). Results are cached as this is called from both - * buildLangfiles and buildLangfileShims. - */ -function getLanguages() { - if (!languages) { - const skip = /^(keys|synonyms|qqq|constants)\.json$/; - languages = fs - .readdirSync(path.join('msg', 'json')) - .filter((file) => file.endsWith('json') && !skip.test(file)) - .map((file) => file.replace(/\.json$/, '')); - } - return languages; -} - -/** - * This task builds Blockly's lang files. - * msg/*.js - */ -function buildLangfiles(done) { - // Create output directory. - fs.mkdirSync(LANG_BUILD_DIR, {recursive: true}); - - // Run create_messages.py. - const inputFiles = getLanguages().map((lang) => - path.join('msg', 'json', `${lang}.json`), - ); - - const createMessagesCmd = `${PYTHON} ./scripts/i18n/create_messages.py \ - --source_lang_file ${path.join('msg', 'json', 'en.json')} \ - --source_synonym_file ${path.join('msg', 'json', 'synonyms.json')} \ - --source_constants_file ${path.join('msg', 'json', 'constants.json')} \ - --key_file ${path.join('msg', 'json', 'keys.json')} \ - --output_dir ${LANG_BUILD_DIR} \ - --quiet ${inputFiles.join(' ')}`; - execSync(createMessagesCmd, {stdio: 'inherit'}); - - done(); -} - /** * Return the path to the generated chunk exporter for the given * chunk, relative to TSC_OUTPUT_DIR. @@ -786,43 +703,6 @@ ${exportedNames.map((name) => ` ${name},`).join('\n')} await fsPromises.rm(TMP_PACKAGE_JSON); } -/** - * This task builds the ESM wrappers used by the langfiles "import" - * entrypoints declared in package.json. - */ -async function buildLangfileShims() { - // Create output directory. - fs.mkdirSync(path.join(RELEASE_DIR, 'msg'), {recursive: true}); - - // Get the names of the exports from the langfile by require()ing - // msg/messages.js and letting it mutate the (global) Blockly.Msg. - // (We have to do it this way because messages.js is a script and - // not a CJS module with exports.) - globalThis.Blockly = {Msg: {}}; - await import('../../msg/messages.js'); - const exportedNames = Object.keys(globalThis.Blockly.Msg); - delete globalThis.Blockly; - - await Promise.all( - getLanguages().map(async (lang) => { - // Write an ESM wrapper that imports the CJS module and re-exports - // its named exports. - const cjsPath = `./${lang}.js`; - const wrapperPath = path.join(RELEASE_DIR, 'msg', `${lang}.mjs`); - const safeLang = lang.replace(/-/g, '_'); - - await fsPromises.writeFile( - wrapperPath, - `import ${safeLang} from '${cjsPath}'; -export const { -${exportedNames.map((name) => ` ${name},`).join('\n')} -} = ${safeLang}; -`, - ); - }), - ); -} - /** * This task uses Closure Compiler's ADVANCED_OPTIMIZATIONS mode to * compile together Blockly core, blocks and generators with a simple @@ -862,15 +742,13 @@ function compileAdvancedCompilationTest() { .pipe(gulp.dest('./tests/compile/')); } -// Main sequence targets. Each should invoke any immediate prerequisite(s). -export const langfiles = gulp.parallel(buildLangfiles, buildLangfileShims); // function tsc, above export const minify = gulp.series( buildChunkExporters, buildCompiled, buildShims, ); -export const build = gulp.parallel(minify, langfiles); +export const build = gulp.parallel(minify); // Manually-invokable targets, with prerequisites where required. // function messages, above diff --git a/packages/blockly/scripts/langfiles.mjs b/packages/blockly/scripts/langfiles.mjs new file mode 100644 index 00000000000..b2cc495eba2 --- /dev/null +++ b/packages/blockly/scripts/langfiles.mjs @@ -0,0 +1,104 @@ +/** + * @license + * Copyright 2026 Raspberry Pi Foundation + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Functions for building language files. + */ + +import {execSync} from 'child_process'; +import {mkdirSync, readdirSync} from 'fs'; +import {writeFile} from 'fs/promises'; +import * as path from 'path'; + +import {LANG_BUILD_DIR, PYTHON, RELEASE_DIR} from './build_constants.mjs'; + +let languages = null; + +/** + * Get list of languages to build langfiles and/or shims for, based on .json + * files in msg/json/, skipping certain entries that do not correspond to an + * actual language). Results are cached as this is called from both + * buildLangfiles and buildLangfileShims. + */ +function getLanguages() { + if (!languages) { + const skip = /^(keys|synonyms|qqq|constants)\.json$/; + languages = readdirSync(path.join('msg', 'json')) + .filter((file) => file.endsWith('json') && !skip.test(file)) + .map((file) => file.replace(/\.json$/, '')); + } + return languages; +} + +/** + * This task builds Blockly's lang files. + * msg/*.js + */ +function buildLangfiles() { + // Create output directory. + mkdirSync(LANG_BUILD_DIR, {recursive: true}); + + // Run create_messages.py. + const inputFiles = getLanguages().map((lang) => + path.join('msg', 'json', `${lang}.json`), + ); + + const createMessagesCmd = `${PYTHON} ./scripts/i18n/create_messages.py \ + --source_lang_file ${path.join('msg', 'json', 'en.json')} \ + --source_synonym_file ${path.join('msg', 'json', 'synonyms.json')} \ + --source_constants_file ${path.join('msg', 'json', 'constants.json')} \ + --key_file ${path.join('msg', 'json', 'keys.json')} \ + --output_dir ${LANG_BUILD_DIR} \ + --quiet ${inputFiles.join(' ')}`; + execSync(createMessagesCmd, {stdio: 'inherit'}); +} + +/** + * This task builds the ESM wrappers used by the langfiles "import" + * entrypoints declared in package.json. + */ +async function buildLangfileShims() { + // Create output directory. + mkdirSync(path.join(RELEASE_DIR, 'msg'), {recursive: true}); + + // Get the names of the exports from the langfile by require()ing + // msg/messages.js and letting it mutate the (global) Blockly.Msg. + // (We have to do it this way because messages.js is a script and + // not a CJS module with exports.) + globalThis.Blockly = {Msg: {}}; + await import('../msg/messages.js'); + const exportedNames = Object.keys(globalThis.Blockly.Msg); + delete globalThis.Blockly; + + await Promise.all( + getLanguages().map(async (lang) => { + // Write an ESM wrapper that imports the CJS module and re-exports + // its named exports. + const cjsPath = `./${lang}.js`; + const wrapperPath = path.join(RELEASE_DIR, 'msg', `${lang}.mjs`); + const safeLang = lang.replace(/-/g, '_'); + + await writeFile( + wrapperPath, + `import ${safeLang} from '${cjsPath}'; +export const { +${exportedNames.map((name) => ` ${name},`).join('\n')} +} = ${safeLang}; +`, + ); + }), + ); +} + +/** + * Run all of the functions needed to build langfiles. + */ +async function langfiles() { + await buildLangfiles(); + await buildLangfileShims(); +} + +await langfiles(); diff --git a/packages/blockly/scripts/messages.mjs b/packages/blockly/scripts/messages.mjs new file mode 100644 index 00000000000..66d333d8489 --- /dev/null +++ b/packages/blockly/scripts/messages.mjs @@ -0,0 +1,44 @@ +/** + * @license + * Copyright 2026 Raspberry Pi Foundation + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Functions for generating message files + */ + +import {execSync} from 'child_process'; +import * as path from 'path'; + +import {PYTHON} from './build_constants.mjs'; + +/** + * This task regenerates msg/json/en.js and msg/json/qqq.js from + * msg/messages.js. + */ +export function messages() { + // Run js_to_json.py + const jsToJsonCmd = `${PYTHON} scripts/i18n/js_to_json.py \ + --input_file ${path.join('msg', 'messages.js')} \ + --output_dir ${path.join('msg', 'json')} \ + --quiet`; + execSync(jsToJsonCmd, {stdio: 'inherit'}); + + console.log(` +Regenerated several flies in msg/json/. Now run + + git diff msg/json/*.json + +and check that operation has not overwritten any modifications made to +hints, etc. by the TranslateWiki volunteers. If it has, backport +their changes to msg/messages.js and re-run 'npm run messages'. + +Once you are satisfied that any new hints have been backported you may +go ahead and commit the changes, but note that the messages script +will have removed the translator credits - be careful not to commit +this removal! +`); +} + +messages(); From 6cc47f63680c60ac687a6f85a192cc13494ee08a Mon Sep 17 00:00:00 2001 From: lizschwab Date: Thu, 24 Sep 2026 10:40:17 -0700 Subject: [PATCH 5/5] chore: move clean script off gulp --- packages/blockly/gulpfile.mjs | 5 ----- packages/blockly/package.json | 2 +- packages/blockly/scripts/clean.mjs | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 packages/blockly/scripts/clean.mjs diff --git a/packages/blockly/gulpfile.mjs b/packages/blockly/gulpfile.mjs index 586e73be89e..d21e4874c82 100644 --- a/packages/blockly/gulpfile.mjs +++ b/packages/blockly/gulpfile.mjs @@ -16,7 +16,6 @@ // // organize-imports-ignore -import {parallel} from 'gulp'; import { deployDemos, deployDemosBeta, @@ -27,9 +26,6 @@ import { buildAdvancedCompilationTest, minify, } from './scripts/gulpfiles/build_tasks.mjs'; -import {cleanBuildDir, cleanReleaseDir} from './scripts/lib/fs_utils.mjs'; - -const clean = parallel(cleanBuildDir, cleanReleaseDir); // Default target if gulp invoked without specifying. export default build; @@ -52,6 +48,5 @@ export { // // prettier-ignore export { - clean, buildAdvancedCompilationTest, } diff --git a/packages/blockly/package.json b/packages/blockly/package.json index 861eaecf5e7..f3ccbf0dccc 100644 --- a/packages/blockly/package.json +++ b/packages/blockly/package.json @@ -99,7 +99,7 @@ "build-debug-log": "npm run build:debug > build-debug.log 2>&1 && tail -3 build-debug.log", "build-strict": "gulp build --verbose --strict", "build-strict-log": "npm run build:strict > build-debug.log 2>&1 && tail -3 build-debug.log", - "clean": "gulp clean", + "clean": "node \"scripts/clean.mjs\"", "deployDemos": "npm ci && gulp deployDemos", "deployDemos:beta": "npm ci && gulp deployDemosBeta", "messages": "node \"scripts/messages.mjs\"", diff --git a/packages/blockly/scripts/clean.mjs b/packages/blockly/scripts/clean.mjs new file mode 100644 index 00000000000..26c133caf1a --- /dev/null +++ b/packages/blockly/scripts/clean.mjs @@ -0,0 +1,14 @@ +/** + * @license + * Copyright 2026 Raspberry Pi Foundation + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Script to clean the workspace of old build/package/etc. files. + */ + +import {cleanBuildDir, cleanReleaseDir} from './lib/fs_utils.mjs'; + +await cleanBuildDir(); +await cleanReleaseDir();