From 7d9b15e1cb4943bd5e84110aa9dbefd03272e131 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 29 Mar 2022 19:05:27 +0000 Subject: [PATCH 1/6] Use --exclude to skip node_modules Instead of copying and then deleting them. This will also catch some node_modules directories that were missed. --- ci/build/build-release.sh | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/ci/build/build-release.sh b/ci/build/build-release.sh index 53e13a557e75..b2022fcd5de6 100755 --- a/ci/build/build-release.sh +++ b/ci/build/build-release.sh @@ -78,11 +78,25 @@ EOF bundle_vscode() { mkdir -p "$VSCODE_OUT_PATH" - # - Some extensions have a .gitignore which excludes their built source from - # the npm package so exclude any .gitignore files. - # - Exclude Node as we will add it ourselves for the standalone and will not - # need it for the npm package. - rsync -avh --exclude .gitignore --exclude /node ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH" + local rsync_opts=() + if [[ ${DEBUG-} = 1 ]]; then + rsync_opts+=(-vh) + fi + + # Some extensions have a .gitignore which excludes their built source from the + # npm package so exclude any .gitignore files. + rsync_opts+=(--exclude .gitignore) + + # Exclude Node as we will add it ourselves for the standalone and will not + # need it for the npm package. + rsync_opts+=(--exclude /node) + + # Exclude Node modules. + if [[ $KEEP_MODULES = 0 ]]; then + rsync_opts+=(--exclude node_modules) + fi + + rsync "${rsync_opts[@]}" ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH" # Add the commit, date, our name, links, and enable telemetry. This just makes # telemetry available; telemetry can still be disabled by flag or setting. @@ -131,11 +145,6 @@ EOF rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock" - if [ "$KEEP_MODULES" = 0 ]; then - rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules" - rm -Rf "$VSCODE_OUT_PATH/node_modules" - fi - pushd "$VSCODE_OUT_PATH" symlink_asar popd From 4107f115845f3e14b3c1fe007c6e9d786c786226 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 29 Mar 2022 21:18:37 +0000 Subject: [PATCH 2/6] Remove per-extension dependency install Code packages all the dependencies using webpack for each extension so there are no dependencies to install. --- ci/build/npm-postinstall.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ci/build/npm-postinstall.sh b/ci/build/npm-postinstall.sh index 123b56dfbb48..fd437a65228d 100755 --- a/ci/build/npm-postinstall.sh +++ b/ci/build/npm-postinstall.sh @@ -98,14 +98,6 @@ vscode_yarn() { cd extensions yarn --production --frozen-lockfile - - for ext in */; do - ext="${ext%/}" - echo "extensions/$ext: installing dependencies" - cd "$ext" - yarn --production --frozen-lockfile - cd "$OLDPWD" - done } main "$@" From ede7125676615138921dcf5a896341fa3ba2a7f3 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 29 Mar 2022 21:21:24 +0000 Subject: [PATCH 3/6] Include source maps I also moved this to its own patch because it feels sufficiently standalone. Fixes #5026. --- patches/integration.diff | 14 ------------- patches/series | 1 + patches/sourcemaps.diff | 43 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 patches/sourcemaps.diff diff --git a/patches/integration.diff b/patches/integration.diff index 81db69f18c20..6f629c2e2c84 100644 --- a/patches/integration.diff +++ b/patches/integration.diff @@ -7,7 +7,6 @@ Prepare Code for integration with code-server 3. Add the code-server version to the help dialog. 4. Add ready events for use in an iframe. 5. Add our icons. -6. Remove sourcemap host since we cannot upload ours there. Index: code-server/lib/vscode/src/vs/server/node/server.main.ts =================================================================== @@ -254,16 +253,3 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html -Index: code-server/lib/vscode/build/gulpfile.reh.js -=================================================================== ---- code-server.orig/lib/vscode/build/gulpfile.reh.js -+++ code-server/lib/vscode/build/gulpfile.reh.js -@@ -365,7 +365,7 @@ function packageTask(type, platform, arc - const minifyTask = task.define(`minify-vscode-${type}`, task.series( - optimizeTask, - util.rimraf(`out-vscode-${type}-min`), -- common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`) -+ common.minifyTask(`out-vscode-${type}`, ``) - )); - gulp.task(minifyTask); - diff --git a/patches/series b/patches/series index e7d291ab1073..d812592b1c2b 100644 --- a/patches/series +++ b/patches/series @@ -18,3 +18,4 @@ local-storage.diff service-worker.diff last-opened.diff connection-type.diff +sourcemaps.diff diff --git a/patches/sourcemaps.diff b/patches/sourcemaps.diff new file mode 100644 index 000000000000..fe0e260748e3 --- /dev/null +++ b/patches/sourcemaps.diff @@ -0,0 +1,43 @@ +Make sourcemaps self-hosted + +Normally source maps get removed as part of the build process so prevent that +from happening. Also avoid using the windows.net host since obviously we can +not host our source maps there and want them to be self-hosted even if we could. + +To test try debugging/browsing the source of a build in a browser. + +Index: code-server/lib/vscode/build/gulpfile.reh.js +=================================================================== +--- code-server.orig/lib/vscode/build/gulpfile.reh.js ++++ code-server/lib/vscode/build/gulpfile.reh.js +@@ -195,8 +195,7 @@ function packageTask(type, platform, arc + + const src = gulp.src(sourceFolderName + '/**', { base: '.' }) + .pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); })) +- .pipe(util.setExecutableBit(['**/*.sh'])) +- .pipe(filter(['**', '!**/*.js.map'])); ++ .pipe(util.setExecutableBit(['**/*.sh'])); + + const workspaceExtensionPoints = ['debuggers', 'jsonValidation']; + const isUIExtension = (manifest) => { +@@ -235,9 +234,9 @@ function packageTask(type, platform, arc + .map(name => `.build/extensions/${name}/**`); + + const extensions = gulp.src(extensionPaths, { base: '.build', dot: true }); +- const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true }); +- const sources = es.merge(src, extensions, extensionsCommonDependencies) ++ const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true }) + .pipe(filter(['**', '!**/*.js.map'], { dot: true })); ++ const sources = es.merge(src, extensions, extensionsCommonDependencies); + + let version = packageJson.version; + const quality = product.quality; +@@ -363,7 +362,7 @@ function packageTask(type, platform, arc + const minifyTask = task.define(`minify-vscode-${type}`, task.series( + optimizeTask, + util.rimraf(`out-vscode-${type}-min`), +- common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`) ++ common.minifyTask(`out-vscode-${type}`, '') + )); + gulp.task(minifyTask); + From c24fa950dd2753b132f5ca0c17aac40b139a0ba5 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 29 Mar 2022 21:22:02 +0000 Subject: [PATCH 4/6] Refresh language patch The base is slightly different so it needed to be refreshed. --- patches/display-language.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/display-language.diff b/patches/display-language.diff index d5ddfa785a52..bbcaa67310fd 100644 --- a/patches/display-language.diff +++ b/patches/display-language.diff @@ -79,7 +79,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html + } catch (error) { /* Probably fine. */ } Object.keys(self.webPackagePaths).map(function (key, index) { self.webPackagePaths[key] = new URL( - `{{VS_BASE}}/static/remote/web/node_modules/${key}/${self.webPackagePaths[key]}`, + `{{VS_BASE}}/static/node_modules/${key}/${self.webPackagePaths[key]}`, @@ -52,7 +76,8 @@ return value; } From f228cc9afe3c0184bad33462e1b63d2e86d8b59d Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 29 Mar 2022 21:35:09 +0000 Subject: [PATCH 5/6] Add missing package.json This was caused by switching to Code's package step which does not include the package.json. Fixes #5019. --- ci/build/build-release.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/build/build-release.sh b/ci/build/build-release.sh index b2022fcd5de6..91af4d30d3d6 100755 --- a/ci/build/build-release.sh +++ b/ci/build/build-release.sh @@ -145,6 +145,11 @@ EOF rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock" + # Include global extension dependencies as well. + rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json" + rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock" + rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions/postinstall.js" + pushd "$VSCODE_OUT_PATH" symlink_asar popd From 4ae5e26ce7ed96a31c92211fc3026e1403725e3f Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 29 Mar 2022 22:03:07 +0000 Subject: [PATCH 6/6] Include keytar It seems this actually is used now. --- ci/build/build-release.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ci/build/build-release.sh b/ci/build/build-release.sh index 91af4d30d3d6..e876f1268425 100755 --- a/ci/build/build-release.sh +++ b/ci/build/build-release.sh @@ -136,10 +136,8 @@ EOF ) > "$VSCODE_OUT_PATH/product.json" # Use the package.json for the web/remote server. It does not have the right - # version though so pull that from the main package.json. Also remove keytar - # since the web does not rely on it and that removes the dependency on - # libsecret. - jq --slurp '.[0] * {version: .[1].version} | del(.dependencies.keytar)' \ + # version though so pull that from the main package.json. + jq --slurp '.[0] * {version: .[1].version}' \ "$VSCODE_SRC_PATH/remote/package.json" \ "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"