Skip to content

fix: add missing package.json and source maps #5040

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

Merged
merged 6 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
38 changes: 25 additions & 13 deletions ci/build/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

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

What does -vh stand for here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah:

  • -h: -h, --human-readable output numbers in a human-readable format
  • -v: -v, --verbose increase verbosity

Source: https://linux.die.net/man/1/rsync

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"
Comment on lines +84 to +99
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach looks a lot cleaner 👏🏼


# Add the commit, date, our name, links, and enable telemetry. This just makes
# telemetry available; telemetry can still be disabled by flag or setting.
Expand Down Expand Up @@ -122,19 +136,17 @@ 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}' \
Comment on lines +139 to +140
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch! How'd you figure this out? That log message when code-server starts up? IIRC

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup hahaha, no idea how I did not see it before

Copy link
Member Author

@code-asher code-asher Mar 30, 2022

Choose a reason for hiding this comment

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

Fortunately we still have libsecret as a dependency (which keytar needs) in our docs (as far as I could tell, hopefully I did not miss a spot) so nothing else changes

"$VSCODE_SRC_PATH/remote/package.json" \
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"

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
# 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
Expand Down
8 changes: 0 additions & 8 deletions ci/build/npm-postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines -101 to -108
Copy link
Contributor

Choose a reason for hiding this comment

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

beautiful find

Copy link
Member Author

Choose a reason for hiding this comment

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

Hopefully I am not wrong about this removal hahaha

Copy link
Member Author

Choose a reason for hiding this comment

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

Before the next release we might want to run through all the builtin extensions to see if we have any more issues with them

Copy link
Contributor

Choose a reason for hiding this comment

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

Good idea. I'll add a note to the release issue

}

main "$@"
2 changes: 1 addition & 1 deletion patches/display-language.diff
Original file line number Diff line number Diff line change
Expand Up @@ -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]}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be changed in my upstream PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, this is not part of the changes this patch applies, it is just part of the surrounding context. So this change is from an earlier patch.

@@ -52,7 +76,8 @@
return value;
}
Expand Down
14 changes: 0 additions & 14 deletions patches/integration.diff
Original file line number Diff line number Diff line change
Expand Up @@ -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
===================================================================
Expand Down Expand Up @@ -254,16 +253,3 @@ Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<link data-name="vs/workbench/workbench.web.main" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.main.css">

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);

1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ local-storage.diff
service-worker.diff
last-opened.diff
connection-type.diff
sourcemaps.diff
43 changes: 43 additions & 0 deletions patches/sourcemaps.diff
Original file line number Diff line number Diff line change
@@ -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);