5ce99f8d1c
* chore: update Code to 1.67 Was able to remove our changes to common/webview.ts since they are upstream now. Other than that no serious changes, just context diffs. * chore: update Code to 1.68 - Upstream moved the web socket endpoint so change the Express route from / to *. That will let web sockets work at any endpoint. - Everything in the workbench config is basically the same but de-indented (upstream extracted it into a separate object which resulted in a de-indent), the ordering is slightly different, and instead of vscodeBase we now need vscodeBase + this._staticRoute since everything is served from a sub-path now. - Move manifest link back to the root since that is where we host our manifest. - Change RemoteAuthoritiesImpl to use the same path building method as in other places (+ instead of using URI.parse/join). - Use existing host/port in RemoteAuthoritiesImpl and BrowserSocketFactory instead of patching them to use window.location (these are set from window.location to begin with so it should be the same result but with less patching). - Since BrowserSocketFactory includes a sub-path now (endpoints were changed upstream to serve from /quality/commit instead of from the root) the patch there has changed to prepend the base to that path (instead of using the base directly). - The workbench HTML now natively supports a base URL in the form of WORKBENCH_WEB_BASE_URL so no need for VS_BASE patches there anymore. - Upstream added type="image/x-icon" so I did as well. - Move the language patch to the end of the series so it is easier to eventually remove. - Remove the existing NLS config in favor of one that supports extensions. - Upstream deleted webview main.js and inlined it into the HTML so move that code (the parent origin check) into both those HTML files (index.html and index-no-csp.html). - The remaining diff is from changes to the surrounding context or a line was changed slightly by upstream (for example renamed files or new arguments like to the remote authority resolver). * fix: modify product.json before building Code injects this into the client during the build process so it needs to be updated before we build. * fix: update inline script nonces * Update HTML base path test * fix: missing commit Code overrides it with nothing. The date is also already injected. * fix: web extensions breaking when the commit changes By just using the marketplace directly instead of going through the backend. I am not sure what the point is when searching extensions already goes directly to the marketplace anyway. But also remove the prefix that breaks this as well because otherwise existing installations will break.
120 lines
3.8 KiB
Bash
Executable File
120 lines
3.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# This script requires vscode to be built with matching MINIFY.
|
|
|
|
# MINIFY controls whether minified vscode is bundled.
|
|
MINIFY="${MINIFY-true}"
|
|
|
|
# KEEP_MODULES controls whether the script cleans all node_modules requiring a yarn install
|
|
# to run first.
|
|
KEEP_MODULES="${KEEP_MODULES-0}"
|
|
|
|
main() {
|
|
cd "$(dirname "${0}")/../.."
|
|
|
|
source ./ci/lib.sh
|
|
|
|
VSCODE_SRC_PATH="lib/vscode"
|
|
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
|
|
|
|
mkdir -p "$RELEASE_PATH"
|
|
|
|
bundle_code_server
|
|
bundle_vscode
|
|
|
|
rsync ./docs/README.md "$RELEASE_PATH"
|
|
rsync LICENSE "$RELEASE_PATH"
|
|
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
|
|
}
|
|
|
|
bundle_code_server() {
|
|
rsync out "$RELEASE_PATH"
|
|
|
|
# For source maps and images.
|
|
mkdir -p "$RELEASE_PATH/src/browser"
|
|
rsync src/browser/media/ "$RELEASE_PATH/src/browser/media"
|
|
mkdir -p "$RELEASE_PATH/src/browser/pages"
|
|
rsync src/browser/pages/*.html "$RELEASE_PATH/src/browser/pages"
|
|
rsync src/browser/pages/*.css "$RELEASE_PATH/src/browser/pages"
|
|
rsync src/browser/robots.txt "$RELEASE_PATH/src/browser"
|
|
|
|
# Add typings for plugins
|
|
mkdir -p "$RELEASE_PATH/typings"
|
|
rsync typings/pluginapi.d.ts "$RELEASE_PATH/typings"
|
|
|
|
# Adds the commit to package.json
|
|
jq --slurp '.[0] * .[1]' package.json <(
|
|
cat << EOF
|
|
{
|
|
"commit": "$(git rev-parse HEAD)",
|
|
"scripts": {
|
|
"postinstall": "sh ./postinstall.sh"
|
|
}
|
|
}
|
|
EOF
|
|
) > "$RELEASE_PATH/package.json"
|
|
rsync yarn.lock "$RELEASE_PATH"
|
|
|
|
# To ensure deterministic dependency versions (even when code-server is installed with NPM), we seed
|
|
# an npm-shrinkwrap file from our yarn lockfile and the current node-modules installed.
|
|
synp --source-file yarn.lock
|
|
npm shrinkwrap
|
|
# HACK@edvincent: The shrinkwrap file will contain the devDependencies, which by default
|
|
# are installed if present in a lockfile. To avoid every user having to specify --production
|
|
# to skip them, we carefully remove them from the shrinkwrap file.
|
|
json -f npm-shrinkwrap.json -I -e "Object.keys(this.dependencies).forEach(dependency => { if (this.dependencies[dependency].dev) { delete this.dependencies[dependency] } } )"
|
|
mv npm-shrinkwrap.json "$RELEASE_PATH"
|
|
|
|
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
|
|
|
|
if [ "$KEEP_MODULES" = 1 ]; then
|
|
rsync node_modules/ "$RELEASE_PATH/node_modules"
|
|
mkdir -p "$RELEASE_PATH/lib"
|
|
rsync ./lib/coder-cloud-agent "$RELEASE_PATH/lib"
|
|
fi
|
|
}
|
|
|
|
bundle_vscode() {
|
|
mkdir -p "$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"
|
|
|
|
# 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.
|
|
jq --slurp '.[0] * {version: .[1].version}' \
|
|
"$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"
|
|
|
|
# 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.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
|
|
|
|
pushd "$VSCODE_OUT_PATH"
|
|
symlink_asar
|
|
popd
|
|
}
|
|
|
|
main "$@"
|