Skip to content

Commit 06e36b4

Browse files
authored
fix: add missing package.json and source maps (#5040)
* Use --exclude to skip node_modules Instead of copying and then deleting them. This will also catch some node_modules directories that were missed. * Remove per-extension dependency install Code packages all the dependencies using webpack for each extension so there are no dependencies to install. * Include source maps I also moved this to its own patch because it feels sufficiently standalone. Fixes #5026. * Refresh language patch The base is slightly different so it needed to be refreshed. * Add missing package.json This was caused by switching to Code's package step which does not include the package.json. Fixes #5019. * Include keytar It seems this actually is used now.
1 parent be0fe10 commit 06e36b4

6 files changed

+70
-36
lines changed

ci/build/build-release.sh

+25-13
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,25 @@ EOF
7878
bundle_vscode() {
7979
mkdir -p "$VSCODE_OUT_PATH"
8080

81-
# - Some extensions have a .gitignore which excludes their built source from
82-
# the npm package so exclude any .gitignore files.
83-
# - Exclude Node as we will add it ourselves for the standalone and will not
84-
# need it for the npm package.
85-
rsync -avh --exclude .gitignore --exclude /node ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
81+
local rsync_opts=()
82+
if [[ ${DEBUG-} = 1 ]]; then
83+
rsync_opts+=(-vh)
84+
fi
85+
86+
# Some extensions have a .gitignore which excludes their built source from the
87+
# npm package so exclude any .gitignore files.
88+
rsync_opts+=(--exclude .gitignore)
89+
90+
# Exclude Node as we will add it ourselves for the standalone and will not
91+
# need it for the npm package.
92+
rsync_opts+=(--exclude /node)
93+
94+
# Exclude Node modules.
95+
if [[ $KEEP_MODULES = 0 ]]; then
96+
rsync_opts+=(--exclude node_modules)
97+
fi
98+
99+
rsync "${rsync_opts[@]}" ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
86100

87101
# Add the commit, date, our name, links, and enable telemetry. This just makes
88102
# telemetry available; telemetry can still be disabled by flag or setting.
@@ -122,19 +136,17 @@ EOF
122136
) > "$VSCODE_OUT_PATH/product.json"
123137

124138
# Use the package.json for the web/remote server. It does not have the right
125-
# version though so pull that from the main package.json. Also remove keytar
126-
# since the web does not rely on it and that removes the dependency on
127-
# libsecret.
128-
jq --slurp '.[0] * {version: .[1].version} | del(.dependencies.keytar)' \
139+
# version though so pull that from the main package.json.
140+
jq --slurp '.[0] * {version: .[1].version}' \
129141
"$VSCODE_SRC_PATH/remote/package.json" \
130142
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
131143

132144
rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock"
133145

134-
if [ "$KEEP_MODULES" = 0 ]; then
135-
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
136-
rm -Rf "$VSCODE_OUT_PATH/node_modules"
137-
fi
146+
# Include global extension dependencies as well.
147+
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
148+
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
149+
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions/postinstall.js"
138150

139151
pushd "$VSCODE_OUT_PATH"
140152
symlink_asar

ci/build/npm-postinstall.sh

-8
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,6 @@ vscode_yarn() {
9898

9999
cd extensions
100100
yarn --production --frozen-lockfile
101-
102-
for ext in */; do
103-
ext="${ext%/}"
104-
echo "extensions/$ext: installing dependencies"
105-
cd "$ext"
106-
yarn --production --frozen-lockfile
107-
cd "$OLDPWD"
108-
done
109101
}
110102

111103
main "$@"

patches/display-language.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
7979
+ } catch (error) { /* Probably fine. */ }
8080
Object.keys(self.webPackagePaths).map(function (key, index) {
8181
self.webPackagePaths[key] = new URL(
82-
`{{VS_BASE}}/static/remote/web/node_modules/${key}/${self.webPackagePaths[key]}`,
82+
`{{VS_BASE}}/static/node_modules/${key}/${self.webPackagePaths[key]}`,
8383
@@ -52,7 +76,8 @@
8484
return value;
8585
}

patches/integration.diff

-14
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Prepare Code for integration with code-server
77
3. Add the code-server version to the help dialog.
88
4. Add ready events for use in an iframe.
99
5. Add our icons.
10-
6. Remove sourcemap host since we cannot upload ours there.
1110

1211
Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
1312
===================================================================
@@ -254,16 +253,3 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
254253
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
255254
<link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.main.css">
256255

257-
Index: code-server/lib/vscode/build/gulpfile.reh.js
258-
===================================================================
259-
--- code-server.orig/lib/vscode/build/gulpfile.reh.js
260-
+++ code-server/lib/vscode/build/gulpfile.reh.js
261-
@@ -365,7 +365,7 @@ function packageTask(type, platform, arc
262-
const minifyTask = task.define(`minify-vscode-${type}`, task.series(
263-
optimizeTask,
264-
util.rimraf(`out-vscode-${type}-min`),
265-
- common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
266-
+ common.minifyTask(`out-vscode-${type}`, ``)
267-
));
268-
gulp.task(minifyTask);
269-

patches/series

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ local-storage.diff
1818
service-worker.diff
1919
last-opened.diff
2020
connection-type.diff
21+
sourcemaps.diff

patches/sourcemaps.diff

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Make sourcemaps self-hosted
2+
3+
Normally source maps get removed as part of the build process so prevent that
4+
from happening. Also avoid using the windows.net host since obviously we can
5+
not host our source maps there and want them to be self-hosted even if we could.
6+
7+
To test try debugging/browsing the source of a build in a browser.
8+
9+
Index: code-server/lib/vscode/build/gulpfile.reh.js
10+
===================================================================
11+
--- code-server.orig/lib/vscode/build/gulpfile.reh.js
12+
+++ code-server/lib/vscode/build/gulpfile.reh.js
13+
@@ -195,8 +195,7 @@ function packageTask(type, platform, arc
14+
15+
const src = gulp.src(sourceFolderName + '/**', { base: '.' })
16+
.pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); }))
17+
- .pipe(util.setExecutableBit(['**/*.sh']))
18+
- .pipe(filter(['**', '!**/*.js.map']));
19+
+ .pipe(util.setExecutableBit(['**/*.sh']));
20+
21+
const workspaceExtensionPoints = ['debuggers', 'jsonValidation'];
22+
const isUIExtension = (manifest) => {
23+
@@ -235,9 +234,9 @@ function packageTask(type, platform, arc
24+
.map(name => `.build/extensions/${name}/**`);
25+
26+
const extensions = gulp.src(extensionPaths, { base: '.build', dot: true });
27+
- const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true });
28+
- const sources = es.merge(src, extensions, extensionsCommonDependencies)
29+
+ const extensionsCommonDependencies = gulp.src('.build/extensions/node_modules/**', { base: '.build', dot: true })
30+
.pipe(filter(['**', '!**/*.js.map'], { dot: true }));
31+
+ const sources = es.merge(src, extensions, extensionsCommonDependencies);
32+
33+
let version = packageJson.version;
34+
const quality = product.quality;
35+
@@ -363,7 +362,7 @@ function packageTask(type, platform, arc
36+
const minifyTask = task.define(`minify-vscode-${type}`, task.series(
37+
optimizeTask,
38+
util.rimraf(`out-vscode-${type}-min`),
39+
- common.minifyTask(`out-vscode-${type}`, `https://ticino.blob.core.windows.net/sourcemaps/${commit}/core`)
40+
+ common.minifyTask(`out-vscode-${type}`, '')
41+
));
42+
gulp.task(minifyTask);
43+

0 commit comments

Comments
 (0)