Merge pull request #225695 from microsoft/ben/handsome-squirrel

esm - add `yarn watch-esm` and `watch-client-esm`
pull/166033/head
Benjamin Pasero 2024-08-15 16:59:30 +02:00 committed by GitHub
commit b96404323b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 10 deletions

View File

@ -34,11 +34,15 @@ gulp.task(compileClientTask);
const watchClientTask = task.define('watch-client', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), task.parallel(watchTask('out', false), watchApiProposalNamesTask)));
gulp.task(watchClientTask);
const watchClientESMTask = task.define('watch-client-esm', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), task.parallel(watchTask('out', false, 'src2'), watchApiProposalNamesTask)));
gulp.task(watchClientESMTask);
// All
const _compileTask = task.define('compile', task.parallel(monacoTypecheckTask, compileClientTask, compileExtensionsTask, compileExtensionMediaTask));
gulp.task(_compileTask);
gulp.task(task.define('watch', task.parallel(/* monacoTypecheckWatchTask, */ watchClientTask, watchExtensionsTask)));
gulp.task(task.define('watch-esm', task.parallel(/* monacoTypecheckWatchTask, */ watchClientESMTask, watchExtensionsTask)));
// Default
gulp.task('default', _compileTask);

View File

@ -139,11 +139,11 @@ function compileTask(src, out, build, options = {}) {
task.taskName = `compile-${path.basename(src)}`;
return task;
}
function watchTask(out, build) {
function watchTask(out, build, srcPath = 'src') {
const task = () => {
const compile = createCompile('src', { build, emitError: false, transpileOnly: false, preserveEnglish: false });
const src = gulp.src('src/**', { base: 'src' });
const watchSrc = watch('src/**', { base: 'src', readDelay: 200 });
const compile = createCompile(srcPath, { build, emitError: false, transpileOnly: false, preserveEnglish: false });
const src = gulp.src(`${srcPath}/**`, { base: srcPath });
const watchSrc = watch(`${srcPath}/**`, { base: srcPath, readDelay: 200 });
const generator = new MonacoGenerator(true);
generator.execute();
return watchSrc

View File

@ -170,13 +170,13 @@ export function compileTask(src: string, out: string, build: boolean, options: {
return task;
}
export function watchTask(out: string, build: boolean): task.StreamTask {
export function watchTask(out: string, build: boolean, srcPath: string = 'src'): task.StreamTask {
const task = () => {
const compile = createCompile('src', { build, emitError: false, transpileOnly: false, preserveEnglish: false });
const compile = createCompile(srcPath, { build, emitError: false, transpileOnly: false, preserveEnglish: false });
const src = gulp.src('src/**', { base: 'src' });
const watchSrc = watch('src/**', { base: 'src', readDelay: 200 });
const src = gulp.src(`${srcPath}/**`, { base: srcPath });
const watchSrc = watch(`${srcPath}/**`, { base: srcPath, readDelay: 200 });
const generator = new MonacoGenerator(true);
generator.execute();

View File

@ -31,7 +31,7 @@ const binaryFileExtensions = new Set([
function migrate() {
console.log(`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`);
console.log(`STARTING MIGRATION of src to src2.`);
console.log(`STARTING AMD->ESM MIGRATION of src to src2.`);
// installing watcher quickly to avoid missing early events
const watchSrc = enableWatching ? watch('src/**', { base: 'src', readDelay: 200 }) : undefined;
@ -49,7 +49,8 @@ function migrate() {
writeFileSync(join(dstFolder, '.gitignore'), `*`);
console.log(`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`);
console.log(`COMPLETED MIGRATION of src to src2. You can now launch yarn watch or yarn watch-client`);
console.log(`COMPLETED AMD->ESM MIGRATION of src to src2. You can now launch yarn watch-esm or yarn watch-client-esm`);
console.log(`Make sure to set the environment variable VSCODE_BUILD_ESM to a string of value 'true' if you want to build VS Code`);
if (watchSrc) {
console.log(`WATCHING src for changes...`);

View File

@ -18,6 +18,7 @@
"postinstall": "node build/npm/postinstall.js",
"compile": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js compile",
"watch": "npm-run-all -lp watch-client watch-extensions",
"watch-esm": "npm-run-all -lp watch-client-esm watch-extensions",
"watchd": "deemon yarn watch",
"watch-webd": "deemon yarn watch-web",
"kill-watchd": "deemon --kill yarn watch",
@ -25,6 +26,7 @@
"restart-watchd": "deemon --restart yarn watch",
"restart-watch-webd": "deemon --restart yarn watch-web",
"watch-client": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js watch-client",
"watch-client-esm": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js watch-client-esm",
"watch-clientd": "deemon yarn watch-client",
"kill-watch-clientd": "deemon --kill yarn watch-client",
"watch-extensions": "node --max-old-space-size=4095 ./node_modules/gulp/bin/gulp.js watch-extensions watch-extension-media",