Add vscode via vendor package.
- Use yarn for vscode vendoring. - Grab hash from package.
This commit is contained in:
committed by
Teffen Ellis
parent
28ba59ab3c
commit
f885b29675
@ -12,10 +12,11 @@ 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"
|
||||
VSCODE_SRC_PATH="vendor/modules/code-oss-dev"
|
||||
VSCODE_OUT_PATH="$RELEASE_PATH/vendor/modules/code-oss-dev"
|
||||
|
||||
mkdir -p "$RELEASE_PATH"
|
||||
|
||||
@ -24,7 +25,7 @@ main() {
|
||||
|
||||
rsync ./docs/README.md "$RELEASE_PATH"
|
||||
rsync LICENSE.txt "$RELEASE_PATH"
|
||||
rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
|
||||
rsync ./vendor/modules/code-oss-dev/ThirdPartyNotices.txt "$RELEASE_PATH"
|
||||
}
|
||||
|
||||
bundle_code_server() {
|
||||
|
@ -7,6 +7,7 @@ export npm_config_build_from_source=true
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
source ./ci/lib.sh
|
||||
|
||||
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
|
||||
@ -19,6 +20,7 @@ main() {
|
||||
node_path="$(yarn -s node <<< 'console.info(process.execPath)')"
|
||||
|
||||
mkdir -p "$RELEASE_PATH/bin"
|
||||
mkdir -p "$RELEASE_PATH/lib"
|
||||
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
|
||||
rsync "$node_path" "$RELEASE_PATH/lib/node"
|
||||
|
||||
@ -32,7 +34,7 @@ main() {
|
||||
# leaves a few stray symlinks. Clean them up so nfpm does not fail.
|
||||
# Remove this line when its no longer needed.
|
||||
|
||||
rm -fr "$RELEASE_PATH/lib/vscode/extensions/node_modules/.bin"
|
||||
rm -fr "$RELEASE_PATH/vendor/modules/code-oss-dev/extensions/node_modules/.bin"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -1,14 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Builds vscode into lib/vscode/out-vscode.
|
||||
# Builds vscode into vendor/modules/code-oss-dev/out-vscode.
|
||||
|
||||
# MINIFY controls whether a minified version of vscode is built.
|
||||
MINIFY=${MINIFY-true}
|
||||
|
||||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
cd lib/vscode
|
||||
|
||||
cd vendor/modules/code-oss-dev
|
||||
|
||||
yarn gulp compile-build compile-extensions-build compile-extension-media
|
||||
yarn gulp optimize --gulpfile ./coder.js
|
||||
|
@ -6,10 +6,6 @@ main() {
|
||||
source ./ci/lib.sh
|
||||
|
||||
git clean -Xffd
|
||||
|
||||
pushd lib/vscode
|
||||
git clean -xffd
|
||||
popd
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -87,13 +87,15 @@ symlink_asar() {
|
||||
}
|
||||
|
||||
vscode_yarn() {
|
||||
cd lib/vscode
|
||||
echo 'Installing vendor dependencies...'
|
||||
cd vendor/modules/code-oss-dev
|
||||
yarn --production --frozen-lockfile
|
||||
|
||||
symlink_asar
|
||||
|
||||
cd extensions
|
||||
yarn --production --frozen-lockfile
|
||||
|
||||
for ext in */; do
|
||||
ext="${ext%/}"
|
||||
echo "extensions/$ext: installing dependencies"
|
||||
|
@ -19,7 +19,7 @@ main() {
|
||||
"*.sh"
|
||||
)
|
||||
prettier --write --loglevel=warn $(
|
||||
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
|
||||
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v "vendor/modules/code-oss-dev" | grep -v 'helm-chart'
|
||||
)
|
||||
|
||||
doctoc --title '# FAQ' docs/FAQ.md > /dev/null
|
||||
@ -32,6 +32,7 @@ main() {
|
||||
doctoc --title '# iPad' docs/ipad.md > /dev/null
|
||||
doctoc --title '# Termux' docs/termux.md > /dev/null
|
||||
|
||||
# TODO: replace with a method that generates fewer false positives.
|
||||
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
|
||||
echo "Files need generation or are formatted incorrectly:"
|
||||
git -c color.ui=always status | grep --color=no '\[31m'
|
||||
|
@ -4,17 +4,14 @@ set -euo pipefail
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode")
|
||||
stylelint $(git ls-files "*.css" | grep -v "lib/vscode")
|
||||
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
|
||||
stylelint $(git ls-files "*.css" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
|
||||
tsc --noEmit --skipLibCheck
|
||||
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
|
||||
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode")
|
||||
if command -v helm && helm kubeval --help > /dev/null; then
|
||||
helm kubeval ci/helm-chart
|
||||
fi
|
||||
|
||||
cd lib/vscode
|
||||
# Run this periodically in vanilla VS code to make sure we don't add any more warnings.
|
||||
yarn -s eslint --max-warnings=3
|
||||
cd "$OLDPWD"
|
||||
}
|
||||
|
||||
|
@ -3,17 +3,28 @@ set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
# This installs the dependencies needed for testing
|
||||
echo 'Installing code-server test dependencies...'
|
||||
|
||||
cd test
|
||||
yarn
|
||||
yarn install
|
||||
cd ..
|
||||
|
||||
cd lib/vscode
|
||||
yarn ${CI+--frozen-lockfile}
|
||||
cd vendor
|
||||
echo 'Installing vendor dependencies...'
|
||||
|
||||
symlink_asar
|
||||
# * We install in 'modules' instead of 'node_modules' because VS Code's extensions
|
||||
# use a webpack config which cannot differentiate between its own node_modules
|
||||
# and itself being in a directory with the same name.
|
||||
#
|
||||
# * We ignore scripts because NPM/Yarn's default behavior is to assume that
|
||||
# devDependencies are not needed, and that even git repo based packages are
|
||||
# assumed to be compiled. Because the default behavior for VS Code's `postinstall`
|
||||
# assumes we're also compiled, this needs to be ignored.
|
||||
yarn install --modules-folder modules --ignore-scripts --frozen-lockfile
|
||||
|
||||
# Finally, run the vendor `postinstall`
|
||||
yarn run postinstall
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
@ -3,6 +3,7 @@ set -euo pipefail
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
source ./ci/lib.sh
|
||||
|
||||
local dir="$PWD"
|
||||
@ -24,7 +25,7 @@ main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d $dir/lib/vscode/out ]]; then
|
||||
if [[ ! -d $dir/vendor/modules/code-oss-dev/out ]]; then
|
||||
echo >&2 "No VS Code build detected"
|
||||
echo >&2 "You can build it with 'yarn build:vscode' or 'yarn watch'"
|
||||
exit 1
|
||||
|
@ -1,133 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Description: This is a script to make the process of updating vscode versions easier
|
||||
# Run it with `yarn update:vscode` and it will do the following:
|
||||
# 1. Check that you have a remote called `vscode`
|
||||
# 2. Ask you which version you want to upgrade to
|
||||
# 3. Grab the exact version from the package.json i.e. 1.53.2
|
||||
# 4. Fetch the vscode remote branches to run the subtree update
|
||||
# 5. Run the subtree update and pull in the vscode update
|
||||
# 6. Commit the changes (including merge conflicts)
|
||||
# 7. Open a draft PR
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# This function expects two arguments
|
||||
# 1. the vscode version we're updating to
|
||||
# 2. the list of merge conflict files
|
||||
make_pr_body() {
|
||||
local BODY="This PR updates vscode to $1
|
||||
|
||||
## TODOS
|
||||
|
||||
- [ ] test editor locally
|
||||
- [ ] test terminal locally
|
||||
- [ ] make notes about any significant changes in docs/CONTRIBUTING.md#notes-about-changes
|
||||
|
||||
## Files with conflicts (fix these)
|
||||
$2"
|
||||
echo "$BODY"
|
||||
}
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
# Check if the remote exists
|
||||
# if it doesn't, we add it
|
||||
if ! git config remote.vscode.url > /dev/null; then
|
||||
echo "Could not find 'vscode' as a remote"
|
||||
echo "Adding with: git remote add vscode https://github.com/microsoft/vscode.git"
|
||||
git remote add vscode https://github.com/microsoft/vscode.git
|
||||
fi
|
||||
|
||||
# Ask which version we should update to
|
||||
# In the future, we'll automate this and grab the latest version automatically
|
||||
read -r -p "What version of VSCode would you like to update to? (i.e. 1.52) " VSCODE_VERSION_TO_UPDATE
|
||||
|
||||
# Check that this version exists
|
||||
if [[ -z $(git ls-remote --heads vscode release/"$VSCODE_VERSION_TO_UPDATE") ]]; then
|
||||
echo "Oops, that doesn't look like a valid version."
|
||||
echo "You entered: $VSCODE_VERSION_TO_UPDATE"
|
||||
echo "Verify that this branches exists here: https://github.com/microsoft/vscode/branches/all?query=release%2F$VSCODE_VERSION_TO_UPDATE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check that they have jq installed
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo "jq could not be found."
|
||||
echo "We use this when looking up the exact version to update to in the package.json in VS Code."
|
||||
echo -e "See docs here: https://stedolan.github.io/jq/download/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Note: `git subtree` returns 129 when installed, and prints help;
|
||||
# but when uninstalled, returns 1.
|
||||
set +e
|
||||
git subtree &> /dev/null
|
||||
if [ $? -ne 129 ]; then
|
||||
echo "git-subtree could not be found."
|
||||
echo "We use this to fetch and update the lib/vscode subtree."
|
||||
echo -e "Please install git subtree."
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
|
||||
# Grab the exact version from package.json
|
||||
VSCODE_EXACT_VERSION=$(curl -s "https://raw.githubusercontent.com/microsoft/vscode/release/$VSCODE_VERSION_TO_UPDATE/package.json" | jq -r ".version")
|
||||
|
||||
echo -e "Great! We'll prep a PR for updating to $VSCODE_EXACT_VERSION\n"
|
||||
|
||||
# For some reason the subtree update doesn't work
|
||||
# unless we fetch all the branches
|
||||
echo -e "Fetching vscode branches..."
|
||||
echo -e "Note: this might take a while"
|
||||
git fetch vscode
|
||||
|
||||
# Check if GitHub CLI is installed
|
||||
if ! command -v gh &> /dev/null; then
|
||||
echo "GitHub CLI could not be found."
|
||||
echo "If you install it before you run this script next time, we'll open a draft PR for you!"
|
||||
echo -e "See docs here: https://github.com/cli/cli#installation\n"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Push branch to remote if not already pushed
|
||||
# If we don't do this, the opening a draft PR step won't work
|
||||
# because it will stop and ask where you want to push the branch
|
||||
CURRENT_BRANCH=$(git branch | grep '\*' | cut -d' ' -f2-)
|
||||
if [[ -z $(git config "branch.${CURRENT_BRANCH}.remote") ]]; then
|
||||
echo "Doesn't look like you've pushed this branch to remote"
|
||||
echo -e "Pushing now using: git push origin $CURRENT_BRANCH\n"
|
||||
# Note: we need to set upstream as well or the gh pr create step will fail
|
||||
# See: https://github.com/cli/cli/issues/575
|
||||
echo "Please set the upstream and re-run the script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Going to try to update vscode for you..."
|
||||
echo -e "Running: git subtree pull --prefix lib/vscode vscode release/${VSCODE_VERSION_TO_UPDATE} --squash\n"
|
||||
# Try to run subtree update command
|
||||
# Note: we add `|| true` because we want the script to keep running even if the squash fails
|
||||
# We know the squash fails everytime because there will always be merge conflicts
|
||||
git subtree pull --prefix lib/vscode vscode release/"${VSCODE_VERSION_TO_UPDATE}" --squash || true
|
||||
|
||||
# Get the files with conflicts before we commit them
|
||||
# so we can list them in the PR body as todo items
|
||||
CONFLICTS=$(git diff --name-only --diff-filter=U | while read -r line; do echo "- [ ] $line"; done)
|
||||
PR_BODY=$(make_pr_body "$VSCODE_EXACT_VERSION" "$CONFLICTS")
|
||||
|
||||
echo -e "\nForcing a commit with conflicts"
|
||||
echo "Note: this is intentional"
|
||||
echo "If we don't do this, code review is impossible."
|
||||
echo -e "For more info, see docs: docs/CONTRIBUTING.md#updating-vs-code\n"
|
||||
# We need --no-verify to skip the husky pre-commit hook
|
||||
# which fails because of the merge conflicts
|
||||
git add . && git commit -am "chore(vscode): update to $VSCODE_EXACT_VERSION" --no-verify
|
||||
|
||||
# Note: we can't open a draft PR unless their are changes.
|
||||
# Hence why we do this after the subtree update.
|
||||
echo "Opening a draft PR on GitHub"
|
||||
# To read about these flags, visit the docs: https://cli.github.com/manual/gh_pr_create
|
||||
gh pr create --base main --title "feat(vscode): update to version $VSCODE_EXACT_VERSION" --body "$PR_BODY" --reviewer @cdr/code-server-reviewers --repo cdr/code-server --draft
|
||||
}
|
||||
|
||||
main "$@"
|
@ -16,7 +16,7 @@ async function main(): Promise<void> {
|
||||
|
||||
class Watcher {
|
||||
private readonly rootPath = path.resolve(__dirname, "../..")
|
||||
private readonly vscodeSourcePath = path.join(this.rootPath, "lib/vscode")
|
||||
private readonly vscodeSourcePath = path.join(this.rootPath, "vendor/modules/code-oss-dev")
|
||||
|
||||
private static log(message: string, skipNewline = false): void {
|
||||
process.stdout.write(message)
|
||||
|
Reference in New Issue
Block a user