chore: move Code to a submodule (#4990)

* Move Code to a submodule

Closes #4901.

* Base Code cache on hash and re-enable node_modules cache

The current setup appears to only rebuild VS Code if the dependencies
change but we need to rebuild it if anything changes.

I also re-enabled the commented out node_modules caches.  They look like
they should work to me with the submodule method.  I think the problem
occurred because Code itself was being installed in the yarn step.
This commit is contained in:
Asher 2022-03-14 21:37:29 -05:00 committed by GitHub
parent 184ef68147
commit 21c74802e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 176 additions and 1743 deletions

View File

@ -29,6 +29,9 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Install Node.js v14 - name: Install Node.js v14
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -38,21 +41,17 @@ jobs:
- name: Install helm - name: Install helm
uses: azure/setup-helm@v1.1 uses: azure/setup-helm@v1.1
# NOTE@jsjoeio - name: Fetch dependencies from cache
# disabling this until we can audit the build process id: cache-yarn
# and the usefulness of this step uses: actions/cache@v2
# See: https://github.com/coder/code-server/issues/4287 with:
# - name: Fetch dependencies from cache path: "**/node_modules"
# id: cache-yarn key: yarn-build-${{ hashFiles('**/yarn.lock') }}
# uses: actions/cache@v2 restore-keys: |
# with: yarn-build-
# path: "**/node_modules"
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# yarn-build-
- name: Install dependencies - name: Install dependencies
# if: steps.cache-yarn.outputs.cache-hit != 'true' if: steps.cache-yarn.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile run: yarn --frozen-lockfile
- name: Run yarn fmt - name: Run yarn fmt
@ -71,6 +70,9 @@ jobs:
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Install Node.js v14 - name: Install Node.js v14
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -102,56 +104,49 @@ jobs:
env: env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps: steps:
- uses: actions/checkout@v3 - name: Checkout repo
uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
submodules: true
- name: Install Node.js v14 - name: Install Node.js v14
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: "14" node-version: "14"
# TODO@Teffen investigate why this omits code-oss-dev/node_modules - name: Fetch dependencies from cache
# - name: Fetch dependencies from cache id: cache-yarn
# id: cache-yarn uses: actions/cache@v2
# uses: actions/cache@v2 with:
# with: path: "**/node_modules"
# path: | key: yarn-build-${{ hashFiles('**/yarn.lock') }}
# "**/node_modules" restore-keys: |
# "**/vendor/modules" yarn-build-
# "**/vendor/modules/code-oss-dev/node_modules"
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/vendor/yarn.lock') }}
# restore-keys: |
# yarn-build-
- name: Install dependencies - name: Install dependencies
# if: steps.cache-yarn.outputs.cache-hit != 'true' if: steps.cache-yarn.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile run: yarn --frozen-lockfile
- name: Build code-server - name: Build code-server
run: yarn build run: yarn build
# Parse the hash of the latest commit inside vendor/modules/code-oss-dev # Get Code's git hash. When this changes it means the content is
# use this to avoid rebuilding it if nothing changed # different and we need to rebuild. Use VSCODE_CACHE_VERSION to force a
# How it works: the `git log` command fetches the hash of the last commit # rebuild.
# that changed a file inside `vendor/modules/code-oss-dev`. If a commit changes any file in there, - name: Get latest lib/vscode rev
# the hash returned will change, and we rebuild vscode. If the hash did not change,
# (for example, a change to `src/` or `docs/`), we reuse the same build as last time.
# This saves a lot of time in CI, as compiling VSCode can take anywhere from 5-10 minutes.
- name: Get latest vendor/modules/code-oss-dev rev
id: vscode-rev id: vscode-rev
run: echo "::set-output name=rev::$(jq -r '.devDependencies["code-oss-dev"]' vendor/package.json | sed -r 's|.*#(.*)$|\1|')" run: echo "::set-output name=rev::$(git rev-parse HEAD:./lib/vscode)"
- name: Attempt to fetch vscode build from cache - name: Fetch Code build from cache
id: cache-vscode-2 id: cache-vscode-2
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
vendor/modules/code-oss-dev/.build lib/vscode/.build
vendor/modules/code-oss-dev/package.json lib/vscode/out-build
vendor/modules/code-oss-dev/out-build lib/vscode/out-vscode-reh-web
vendor/modules/code-oss-dev/out-vscode-reh-web lib/vscode/out-vscode-reh-web-min
vendor/modules/code-oss-dev/out-vscode-reh-web-min
key: vscode-reh-build-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }} key: vscode-reh-build-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}
- name: Build vscode - name: Build vscode
@ -197,7 +192,10 @@ jobs:
if: github.event.pull_request.head.repo.full_name == github.repository if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
id: download id: download
@ -226,7 +224,10 @@ jobs:
container: "centos:7" container: "centos:7"
steps: steps:
- uses: actions/checkout@v3 - name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node.js v14 - name: Install Node.js v14
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -315,7 +316,10 @@ jobs:
NODE_VERSION: v14.17.4 NODE_VERSION: v14.17.4
steps: steps:
- uses: actions/checkout@v3 - name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node.js v14 - name: Install Node.js v14
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -364,7 +368,10 @@ jobs:
runs-on: macos-latest runs-on: macos-latest
timeout-minutes: 15 timeout-minutes: 15
steps: steps:
- uses: actions/checkout@v3 - name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node.js v14 - name: Install Node.js v14
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -409,7 +416,11 @@ jobs:
# since VS Code will load faster due to the bundling. # since VS Code will load faster due to the bundling.
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64" CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
steps: steps:
- uses: actions/checkout@v3 - name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Install Node.js v14 - name: Install Node.js v14
uses: actions/setup-node@v3 uses: actions/setup-node@v3
@ -446,12 +457,6 @@ jobs:
./test/node_modules/.bin/playwright install-deps ./test/node_modules/.bin/playwright install-deps
./test/node_modules/.bin/playwright install ./test/node_modules/.bin/playwright install
# TODO@jsjoeio - remove once we switch to submodules.
- name: Create package.json for testing
run: |
mkdir -p ./vendor/modules/code-oss-dev
echo '{ "version": "test" }' > ./vendor/modules/code-oss-dev/package.json
- name: Run end-to-end tests - name: Run end-to-end tests
run: yarn test:e2e run: yarn test:e2e
@ -468,8 +473,11 @@ jobs:
trivy-scan-repo: trivy-scan-repo:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout code - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run Trivy vulnerability scanner in repo mode - name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18 uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18
with: with:
@ -480,6 +488,7 @@ jobs:
template: "@/contrib/sarif.tpl" template: "@/contrib/sarif.tpl"
output: "trivy-repo-results.sarif" output: "trivy-repo-results.sarif"
severity: "HIGH,CRITICAL" severity: "HIGH,CRITICAL"
- name: Upload Trivy scan results to GitHub Security tab - name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1 uses: github/codeql-action/upload-sarif@v1
with: with:

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "lib/vscode"]
path = lib/vscode
url = https://github.com/coder/vscode

View File

@ -7,7 +7,7 @@ useTabs: false
overrides: overrides:
# Attempt to keep VScode's existing code style intact. # Attempt to keep VScode's existing code style intact.
- files: "vendor/modules/code-oss-dev/**/*.ts" - files: "lib/vscode/**/*.ts"
options: options:
# No limit defined upstream. # No limit defined upstream.
printWidth: 10000 printWidth: 10000

View File

@ -143,7 +143,7 @@
"description": "Static images and the manifest live here in `src/browser/media` (see the explorer)." "description": "Static images and the manifest live here in `src/browser/media` (see the explorer)."
}, },
{ {
"directory": "vendor/modules/code-oss-dev", "directory": "lib/vscode",
"line": 1, "line": 1,
"description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible." "description": "code-server makes use of VS Code's frontend web/remote support. Most of the modifications implement the remote server since that portion of the code is closed source and not released with VS Code.\n\nWe also have a few bug fixes and have added some features (like client-side extensions). See [https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code](https://github.com/coder/code-server/blob/master/docs/CONTRIBUTING.md#modifications-to-vs-code) for a list.\n\nWe make an effort to keep the modifications as few as possible."
} }

View File

@ -15,8 +15,8 @@ main() {
source ./ci/lib.sh source ./ci/lib.sh
VSCODE_SRC_PATH="vendor/modules/code-oss-dev" VSCODE_SRC_PATH="lib/vscode"
VSCODE_OUT_PATH="$RELEASE_PATH/vendor/modules/code-oss-dev" VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
mkdir -p "$RELEASE_PATH" mkdir -p "$RELEASE_PATH"
@ -25,7 +25,7 @@ main() {
rsync ./docs/README.md "$RELEASE_PATH" rsync ./docs/README.md "$RELEASE_PATH"
rsync LICENSE.txt "$RELEASE_PATH" rsync LICENSE.txt "$RELEASE_PATH"
rsync ./vendor/modules/code-oss-dev/ThirdPartyNotices.txt "$RELEASE_PATH" rsync ./lib/vscode/ThirdPartyNotices.txt "$RELEASE_PATH"
} }
bundle_code_server() { bundle_code_server() {

View File

@ -33,8 +33,7 @@ main() {
# HACK: the version of Typescript vscode 1.57 uses in extensions/ # HACK: the version of Typescript vscode 1.57 uses in extensions/
# leaves a few stray symlinks. Clean them up so nfpm does not fail. # leaves a few stray symlinks. Clean them up so nfpm does not fail.
# Remove this line when its no longer needed. # 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 "$@" main "$@"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Builds vscode into vendor/modules/code-oss-dev/out-vscode. # Builds vscode into lib/vscode/out-vscode.
# MINIFY controls whether a minified version of vscode is built. # MINIFY controls whether a minified version of vscode is built.
MINIFY=${MINIFY-true} MINIFY=${MINIFY-true}
@ -9,7 +9,7 @@ MINIFY=${MINIFY-true}
main() { main() {
cd "$(dirname "${0}")/../.." cd "$(dirname "${0}")/../.."
cd vendor/modules/code-oss-dev cd lib/vscode
# Any platform works since we have our own packaging step (for now). # Any platform works since we have our own packaging step (for now).
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}" yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"

View File

@ -90,8 +90,8 @@ symlink_asar() {
} }
vscode_yarn() { vscode_yarn() {
echo 'Installing vendor dependencies...' echo 'Installing Code dependencies...'
cd vendor/modules/code-oss-dev cd lib/vscode
yarn --production --frozen-lockfile yarn --production --frozen-lockfile
symlink_asar symlink_asar

View File

@ -19,7 +19,7 @@ main() {
"*.sh" "*.sh"
) )
prettier --write --loglevel=warn $( prettier --write --loglevel=warn $(
git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v "vendor/modules/code-oss-dev" | grep -v 'helm-chart' git ls-files "${prettierExts[@]}" | grep -v "lib/vscode" | grep -v 'helm-chart'
) )
doctoc --title '# FAQ' docs/FAQ.md > /dev/null doctoc --title '# FAQ' docs/FAQ.md > /dev/null

View File

@ -4,10 +4,10 @@ set -euo pipefail
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode") eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js" | grep -v "lib/vscode")
stylelint $(git ls-files "*.css" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode") stylelint $(git ls-files "*.css" | grep -v "lib/vscode")
tsc --noEmit --skipLibCheck tsc --noEmit --skipLibCheck
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "vendor/modules/code-oss-dev" | grep -v "lib/vscode") shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh" | grep -v "lib/vscode")
if command -v helm && helm kubeval --help > /dev/null; then if command -v helm && helm kubeval --help > /dev/null; then
helm kubeval ci/helm-chart helm kubeval ci/helm-chart
fi fi

View File

@ -1,50 +1,32 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Install dependencies in $1.
install-deps() {
local args=(install)
if [[ ${CI-} ]]; then
args+=(--frozen-lockfile)
fi
# If there is no package.json then yarn will look upward and end up installing
# from the root resulting in an infinite loop (this can happen if you have not
# checked out the submodule yet for example).
if [[ ! -f "$1/package.json" ]]; then
echo "$1/package.json is missing; did you run git submodule update --init?"
exit 1
fi
pushd "$1"
echo "Installing dependencies for $PWD"
yarn "${args[@]}"
popd
}
main() { main() {
cd "$(dirname "$0")/../.." cd "$(dirname "$0")/../.."
source ./ci/lib.sh source ./ci/lib.sh
pushd test install-deps test
echo "Installing dependencies for $PWD" install-deps test/e2e/extensions/test-extension
yarn install install-deps lib/vscode
popd
local args=(install)
if [[ ${CI-} ]]; then
args+=(--frozen-lockfile)
fi
pushd test
echo "Installing dependencies for $PWD"
yarn "${args[@]}"
popd
pushd test/e2e/extensions/test-extension
echo "Installing dependencies for $PWD"
yarn "${args[@]}"
popd
pushd vendor
echo "Installing dependencies for $PWD"
# 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.
args+=(--modules-folder modules)
# 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.
args+=(--ignore-scripts)
yarn "${args[@]}"
# Finally, run the vendor `postinstall`
yarn run postinstall
popd
} }
main "$@" main "$@"

View File

@ -37,7 +37,7 @@ main() {
exit 1 exit 1
fi fi
if [[ ! -d $dir/vendor/modules/code-oss-dev/out ]]; then if [[ ! -d $dir/lib/vscode/out ]]; then
echo >&2 "No VS Code build detected" echo >&2 "No VS Code build detected"
help help
exit 1 exit 1

View File

@ -14,7 +14,7 @@ main() {
# Our code imports from `out` in order to work during development but if you # Our code imports from `out` in order to work during development but if you
# have only built for production you will have not have this directory. In # have only built for production you will have not have this directory. In
# that case symlink `out` to a production build directory. # that case symlink `out` to a production build directory.
local vscode="vendor/modules/code-oss-dev" local vscode="lib/vscode"
local link="$vscode/out" local link="$vscode/out"
local target="out-build" local target="out-build"
if [[ ! -e $link ]] && [[ -d $vscode/$target ]]; then if [[ ! -e $link ]] && [[ -d $vscode/$target ]]; then

View File

@ -14,7 +14,7 @@ class Watcher {
private rootPath = path.resolve(process.cwd()) private rootPath = path.resolve(process.cwd())
private readonly paths = { private readonly paths = {
/** Path to uncompiled VS Code source. */ /** Path to uncompiled VS Code source. */
vscodeDir: path.join(this.rootPath, "vendor", "modules", "code-oss-dev"), vscodeDir: path.join(this.rootPath, "lib/vscode"),
pluginDir: process.env.PLUGIN_DIR, pluginDir: process.env.PLUGIN_DIR,
} }

View File

@ -14,7 +14,7 @@ pkg_json_version() {
} }
vscode_version() { vscode_version() {
jq -r .version vendor/modules/code-oss-dev/package.json jq -r .version lib/vscode/package.json
} }
os() { os() {

View File

@ -83,36 +83,21 @@ The current development workflow is a bit tricky because we have this repo and w
Here are these steps you should follow to get your dev environment setup: Here are these steps you should follow to get your dev environment setup:
1. `git clone https://github.com/coder/code-server.git` - Clone `code-server` 1. `git clone https://github.com/coder/code-server.git` - Clone `code-server`
2. `git clone https://github.com/coder/vscode.git` - Clone `vscode` 2. `git submodule update --init` - Clone `vscode` submodule
3. `cd vscode && yarn install` - install the dependencies in the `vscode` repo 3. `yarn` - Install dependencies
4. `cd code-server && yarn install` - install the dependencies in the `code-server` repo 4. `yarn watch` - This will spin up code-server on localhost:8080 which you can start developing. It will live reload changes to the source.
5. `cd vscode && yarn link` - use `yarn` to create a symlink to the `vscode` repo (`code-oss-dev` package)
6. `cd code-server && yarn link code-oss-dev --modules-folder vendor/modules` - links your local `vscode` repo (`code-oss-dev` package) inside your local version of code-server
7. `cd code-server && yarn watch` - this will spin up code-server on localhost:8080 which you can start developing. It will live reload changes to the source.
### Updates to VS Code ### Updates to VS Code
If changes are made and merged into `main` in the [`coder/vscode`](https://github.com/coder/vscode) repo, then you'll need to update the version in the `code-server` repo by following these steps: If changes are made and merged into `main` in the [`coder/vscode`](https://github.com/coder/vscode) repo, then you'll need to update the version in the `code-server` repo by following these steps:
1. Update the package tag listed in `vendor/package.json`: 1. Update the `lib/vscode` submodule to the latest `main`.
```json
{
"devDependencies": {
"vscode": "coder/vscode#<latest-commit-sha>"
}
}
```
2. From the code-server **project root**, run `yarn install`. 2. From the code-server **project root**, run `yarn install`.
Then, test code-server locally to make sure everything works. 3. Test code-server locally to make sure everything works.
3. Check the Node.js version that's used by Electron (which is shipped with VS 4. Check the Node.js version that's used by Electron (which is shipped with VS
Code. If necessary, update your version of Node.js to match. Code. If necessary, update your version of Node.js to match.
4. Open a PR 5. Commit the updated submodule to `code-server`.
6. Open a PR.
> Watch for updates to
> `vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.html`. You may need to
> make changes to `src/browser/pages/vscode.html`.
### Build ### Build
@ -215,7 +200,7 @@ The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
in [src/node/routes](../src/node/routes). in [src/node/routes](../src/node/routes).
Most of the meaty parts are in the VS Code portion of the codebase under Most of the meaty parts are in the VS Code portion of the codebase under
[vendor/modules/code-oss-dev](../vendor/modules/code-oss-dev), which we describe next. [lib/vscode](../lib/vscode), which we describe next.
### Modifications to VS Code ### Modifications to VS Code
@ -228,66 +213,66 @@ Over time, Microsoft added support to VS Code to run it on the web. They have
made the front-end open source, but not the server. As such, code-server v2 (and made the front-end open source, but not the server. As such, code-server v2 (and
later) uses the VS Code front-end and implements the server. We do this by using later) uses the VS Code front-end and implements the server. We do this by using
a Git subtree to fork and modify VS Code. This code lives under a Git subtree to fork and modify VS Code. This code lives under
[vendor/modules/code-oss-dev](../vendor/modules/code-oss-dev). [lib/vscode](../lib/vscode).
Some noteworthy changes in our version of VS Code include: Some noteworthy changes in our version of VS Code include:
- Adding our build file, [`vendor/modules/code-oss-dev/coder.js`](../vendor/modules/code-oss-dev/coder.js), which includes build steps specific to code-server - Adding our build file, [`lib/vscode/coder.js`](../lib/vscode/coder.js), which includes build steps specific to code-server
- Node.js version detection changes in [`build/lib/node.ts`](../vendor/modules/code-oss-dev/build/lib/node.ts) and [`build/lib/util.ts`](../vendor/modules/code-oss-dev/build/lib/util.ts) - Node.js version detection changes in [`build/lib/node.ts`](../lib/vscode/build/lib/node.ts) and [`build/lib/util.ts`](../lib/vscode/build/lib/util.ts)
- Allowing extra extension directories - Allowing extra extension directories
- Added extra arguments to [`src/vs/platform/environment/common/argv.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/argv.ts) and to [`src/vs/platform/environment/node/argv.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/node/argv.ts) - Added extra arguments to [`src/vs/platform/environment/common/argv.ts`](../lib/vscode/src/vs/platform/environment/common/argv.ts) and to [`src/vs/platform/environment/node/argv.ts`](../lib/vscode/src/vs/platform/environment/node/argv.ts)
- Added extra environment state to [`src/vs/platform/environment/common/environment.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/environment.ts); - Added extra environment state to [`src/vs/platform/environment/common/environment.ts`](../lib/vscode/src/vs/platform/environment/common/environment.ts);
- Added extra getters to [`src/vs/platform/environment/common/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/platform/environment/common/environmentService.ts) - Added extra getters to [`src/vs/platform/environment/common/environmentService.ts`](../lib/vscode/src/vs/platform/environment/common/environmentService.ts)
- Added extra scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../vendor/modules/code-oss-dev/src/vs/platform/extensionManagement/node/extensionsScanner.ts) - Added extra scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../lib/vscode/src/vs/platform/extensionManagement/node/extensionsScanner.ts)
- Additions/removals from [`package.json`](../vendor/modules/code-oss-dev/package.json): - Additions/removals from [`package.json`](../lib/vscode/package.json):
- Removing `electron`, `keytar` and `native-keymap` to avoid pulling in desktop dependencies during build on Linux - Removing `electron`, `keytar` and `native-keymap` to avoid pulling in desktop dependencies during build on Linux
- Removing `gulp-azure-storage` and `gulp-tar` (unsued in our build process, may pull in outdated dependencies) - Removing `gulp-azure-storage` and `gulp-tar` (unsued in our build process, may pull in outdated dependencies)
- Adding `proxy-agent`, `proxy-from-env` (for proxying) and `rimraf` (used during build/install steps) - Adding `proxy-agent`, `proxy-from-env` (for proxying) and `rimraf` (used during build/install steps)
- Adding our branding/custom URLs/version: - Adding our branding/custom URLs/version:
- [`product.json`](../vendor/modules/code-oss-dev/product.json) - [`product.json`](../lib/vscode/product.json)
- [`src/vs/base/common/product.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/product.ts) - [`src/vs/base/common/product.ts`](../lib/vscode/src/vs/base/common/product.ts)
- [`src/vs/workbench/browser/parts/dialogs/dialogHandler.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts) - [`src/vs/workbench/browser/parts/dialogs/dialogHandler.ts`](../lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts) - [`src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts`](../lib/vscode/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.ts)
- [`src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts) - [`src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts`](../lib/vscode/src/vs/workbench/contrib/welcome/page/browser/welcomePage.ts)
- Removing azure/macOS signing related dependencies from [`build/package.json`](../vendor/modules/code-oss-dev/build/package.json) - Removing azure/macOS signing related dependencies from [`build/package.json`](../lib/vscode/build/package.json)
- Modifying `.gitignore` to allow us to add files to `src/vs/server` and modifying `.eslintignore` to ignore lint on the shared files below (we use different formatter settings than VS Code). - Modifying `.gitignore` to allow us to add files to `src/vs/server` and modifying `.eslintignore` to ignore lint on the shared files below (we use different formatter settings than VS Code).
- Sharing some files with our codebase via symlinks: - Sharing some files with our codebase via symlinks:
- [`src/vs/base/common/ipc.d.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/ipc.d.ts) points to [`typings/ipc.d.ts`](../typings/ipc.d.ts) - [`src/vs/base/common/ipc.d.ts`](../lib/vscode/src/vs/base/common/ipc.d.ts) points to [`typings/ipc.d.ts`](../typings/ipc.d.ts)
- [`src/vs/base/common/util.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/util.ts) points to [`src/common/util.ts`](../src/common/util.ts) - [`src/vs/base/common/util.ts`](../lib/vscode/src/vs/base/common/util.ts) points to [`src/common/util.ts`](../src/common/util.ts)
- [`src/vs/base/node/proxy_agent.ts`](../vendor/modules/code-oss-dev/src/vs/base/node/proxy_agent.ts) points to [`src/node/proxy_agent.ts`](../src/node/proxy_agent.ts) - [`src/vs/base/node/proxy_agent.ts`](../lib/vscode/src/vs/base/node/proxy_agent.ts) points to [`src/node/proxy_agent.ts`](../src/node/proxy_agent.ts)
- Allowing socket changes by adding `setSocket` in [`src/vs/base/parts/ipc/common/ipc.net.ts`](../vendor/modules/code-oss-dev/src/vs/base/parts/ipc/common/ipc.net.ts) - Allowing socket changes by adding `setSocket` in [`src/vs/base/parts/ipc/common/ipc.net.ts`](../lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts)
- We use this for connection persistence in our server-side code. - We use this for connection persistence in our server-side code.
- Added our server-side Node.JS code to `src/vs/server`. - Added our server-side Node.JS code to `src/vs/server`.
- This code includes the logic to spawn the various services (extension host, terminal, etc.) and some glue - This code includes the logic to spawn the various services (extension host, terminal, etc.) and some glue
- Added [`src/vs/workbench/browser/client.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/client.ts) to hold some server customizations. - Added [`src/vs/workbench/browser/client.ts`](../lib/vscode/src/vs/workbench/browser/client.ts) to hold some server customizations.
- Includes the functionality for the Log Out command and menu item - Includes the functionality for the Log Out command and menu item
- Also, imported and called `initialize` from the main web file, [`src/vs/workbench/browser/web.main.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/browser/web.main.ts) - Also, imported and called `initialize` from the main web file, [`src/vs/workbench/browser/web.main.ts`](../lib/vscode/src/vs/workbench/browser/web.main.ts)
- Added a (hopefully temporary) hotfix to [`src/vs/workbench/common/resources.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/common/resources.ts) to get context menu actions working for the Git integration. - Added a (hopefully temporary) hotfix to [`src/vs/workbench/common/resources.ts`](../lib/vscode/src/vs/workbench/common/resources.ts) to get context menu actions working for the Git integration.
- Added connection type to WebSocket query parameters in [`src/vs/platform/remote/common/remoteAgentConnection.ts`](../vendor/modules/code-oss-dev/src/vs/platform/remote/common/remoteAgentConnection.ts) - Added connection type to WebSocket query parameters in [`src/vs/platform/remote/common/remoteAgentConnection.ts`](../lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.ts)
- Added `CODE_SERVER*` variables to the sanitization list in [`src/vs/base/common/processes.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/processes.ts) - Added `CODE_SERVER*` variables to the sanitization list in [`src/vs/base/common/processes.ts`](../lib/vscode/src/vs/base/common/processes.ts)
- Fix localization support: - Fix localization support:
- Added file [`src/vs/workbench/services/localizations/browser/localizationsService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/localizations/browser/localizationsService.ts). - Added file [`src/vs/workbench/services/localizations/browser/localizationsService.ts`](../lib/vscode/src/vs/workbench/services/localizations/browser/localizationsService.ts).
- Modified file [`src/vs/base/common/platform.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/platform.ts) - Modified file [`src/vs/base/common/platform.ts`](../lib/vscode/src/vs/base/common/platform.ts)
- Modified file [`src/vs/base/node/languagePacks.js`](../vendor/modules/code-oss-dev/src/vs/base/node/languagePacks.js) - Modified file [`src/vs/base/node/languagePacks.js`](../lib/vscode/src/vs/base/node/languagePacks.js)
- Added code to allow server to inject settings to [`src/vs/platform/product/common/product.ts`](../vendor/modules/code-oss-dev/src/vs/platform/product/common/product.ts) - Added code to allow server to inject settings to [`src/vs/platform/product/common/product.ts`](../lib/vscode/src/vs/platform/product/common/product.ts)
- Extension fixes: - Extension fixes:
- Avoid disabling extensions by extensionKind in [`src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts) (Needed for vscode-icons) - Avoid disabling extensions by extensionKind in [`src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts) (Needed for vscode-icons)
- Remove broken symlinks in [`extensions/postinstall.js`](../vendor/modules/code-oss-dev/extensions/postinstall.js) - Remove broken symlinks in [`extensions/postinstall.js`](../lib/vscode/extensions/postinstall.js)
- Add tip about extension gallery in [`src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts) - Add tip about extension gallery in [`src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts`](../lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.ts)
- Use our own server for GitHub authentication in [`extensions/github-authentication/src/githubServer.ts`](../vendor/modules/code-oss-dev/extensions/github-authentication/src/githubServer.ts) - Use our own server for GitHub authentication in [`extensions/github-authentication/src/githubServer.ts`](../lib/vscode/extensions/github-authentication/src/githubServer.ts)
- Settings persistence on the server in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/environment/browser/environmentService.ts) - Settings persistence on the server in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts)
- Add extension install fallback in [`src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts) - Add extension install fallback in [`src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts`](../lib/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.ts)
- Add proxy-agent monkeypatch and keep extension host indefinitely running in [`src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts) - Add proxy-agent monkeypatch and keep extension host indefinitely running in [`src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts`](../lib/vscode/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts)
- Patch build system to avoid removing extension dependencies for `yarn global add` users in [`build/lib/extensions.ts`](../vendor/modules/code-oss-dev/build/lib/extensions.ts) - Patch build system to avoid removing extension dependencies for `yarn global add` users in [`build/lib/extensions.ts`](../lib/vscode/build/lib/extensions.ts)
- Allow all extensions to use proposed APIs in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/services/environment/browser/environmentService.ts) - Allow all extensions to use proposed APIs in [`src/vs/workbench/services/environment/browser/environmentService.ts`](../lib/vscode/src/vs/workbench/services/environment/browser/environmentService.ts)
- Make storage writes async to allow extensions to wait for them to complete in [`src/vs/platform/storage/common/storage.ts`](../vendor/modules/code-oss-dev/src/vs/platform/storage/common/storage.ts) - Make storage writes async to allow extensions to wait for them to complete in [`src/vs/platform/storage/common/storage.ts`](../lib/vscode/src/vs/platform/storage/common/storage.ts)
- Specify webview path in [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts) - Specify webview path in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
- URL readability improvements for folder/workspace in [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts) - URL readability improvements for folder/workspace in [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
- Socket/Authority-related fixes (for remote proxying etc.): - Socket/Authority-related fixes (for remote proxying etc.):
- [`src/vs/code/browser/workbench/workbench.ts`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts) - [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
- [`src/vs/platform/remote/browser/browserSocketFactory.ts`](../vendor/modules/code-oss-dev/src/vs/platform/remote/browser/browserSocketFactory.ts) - [`src/vs/platform/remote/browser/browserSocketFactory.ts`](../lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.ts)
- [`src/vs/base/common/network.ts`](../vendor/modules/code-oss-dev/src/vs/base/common/network.ts) - [`src/vs/base/common/network.ts`](../lib/vscode/src/vs/base/common/network.ts)
- Added code to write out IPC path in [`src/vs/workbench/api/node/extHostCLIServer.ts`](../vendor/modules/code-oss-dev/src/vs/workbench/api/node/extHostCLIServer.ts) - Added code to write out IPC path in [`src/vs/workbench/api/node/extHostCLIServer.ts`](../lib/vscode/src/vs/workbench/api/node/extHostCLIServer.ts)
As the web portion of VS Code matures, we'll be able to shrink and possibly As the web portion of VS Code matures, we'll be able to shrink and possibly
eliminate our modifications. In the meantime, upgrading the VS Code version requires eliminate our modifications. In the meantime, upgrading the VS Code version requires

1
lib/vscode Submodule

@ -0,0 +1 @@
Subproject commit a13f6e1434ad6ab820eef0ecca5b923b3e275667

View File

@ -127,7 +127,6 @@
"testEnvironment": "node", "testEnvironment": "node",
"testPathIgnorePatterns": [ "testPathIgnorePatterns": [
"/node_modules/", "/node_modules/",
"/vendor/",
"/lib/", "/lib/",
"/out/", "/out/",
"test/e2e" "test/e2e"
@ -158,7 +157,7 @@
"<rootDir>/release-npm-package", "<rootDir>/release-npm-package",
"<rootDir>/release-gcp", "<rootDir>/release-gcp",
"<rootDir>/release-images", "<rootDir>/release-images",
"<rootDir>/vendor" "<rootDir>/lib"
], ],
"moduleNameMapper": { "moduleNameMapper": {
"^.+\\.(css|less)$": "<rootDir>/test/utils/cssStub.ts" "^.+\\.(css|less)$": "<rootDir>/test/utils/cssStub.ts"

View File

@ -17,7 +17,7 @@ export function getPackageJson(relativePath: string): JSONSchemaForNPMPackageJso
} }
export const rootPath = path.resolve(__dirname, "../..") export const rootPath = path.resolve(__dirname, "../..")
export const vsRootPath = path.join(rootPath, "vendor/modules/code-oss-dev") export const vsRootPath = path.join(rootPath, "lib/vscode")
const PACKAGE_JSON = "package.json" const PACKAGE_JSON = "package.json"
const pkg = getPackageJson(`${rootPath}/${PACKAGE_JSON}`) const pkg = getPackageJson(`${rootPath}/${PACKAGE_JSON}`)
const codePkg = getPackageJson(`${vsRootPath}/${PACKAGE_JSON}`) || { version: "0.0.0" } const codePkg = getPackageJson(`${vsRootPath}/${PACKAGE_JSON}`) || { version: "0.0.0" }

View File

@ -31,7 +31,7 @@ export const shouldSpawnCliProcess = (args: UserProvidedArgs): boolean => {
export const runVsCodeCli = async (args: DefaultedArgs): Promise<void> => { export const runVsCodeCli = async (args: DefaultedArgs): Promise<void> => {
logger.debug("Running VS Code CLI") logger.debug("Running VS Code CLI")
// See ../../vendor/modules/code-oss-dev/src/vs/server/node/server.main.js. // See ../../lib/vscode/src/vs/server/node/server.main.js.
const spawnCli = await loadAMDModule<CodeServerLib.SpawnCli>("vs/server/node/server.main", "spawnCli") const spawnCli = await loadAMDModule<CodeServerLib.SpawnCli>("vs/server/node/server.main", "spawnCli")
try { try {

View File

@ -118,7 +118,7 @@ export class CodeServerRouteWrapper {
const { args } = req const { args } = req
/** /**
* @file ../../../vendor/modules/code-oss-dev/src/vs/server/node/server.main.js * @file ../../../lib/vscode/src/vs/server/node/server.main.js
*/ */
const createVSServer = await loadAMDModule<CodeServerLib.CreateServer>("vs/server/node/server.main", "createServer") const createVSServer = await loadAMDModule<CodeServerLib.CreateServer>("vs/server/node/server.main", "createServer")

View File

@ -1,7 +1,7 @@
import { logger } from "@coder/logger" import { logger } from "@coder/logger"
import { mockLogger } from "../../utils/helpers"
import * as semver from "semver"
import path from "path" import path from "path"
import * as semver from "semver"
import { mockLogger } from "../../utils/helpers"
describe("constants", () => { describe("constants", () => {
let constants: typeof import("../../../src/node/constants") let constants: typeof import("../../../src/node/constants")
@ -16,7 +16,7 @@ describe("constants", () => {
} }
const mockCodePackageJson = { const mockCodePackageJson = {
name: "mock-code-oss-dev", name: "mock-vscode",
version: "1.2.3", version: "1.2.3",
} }
@ -24,11 +24,9 @@ describe("constants", () => {
jest.clearAllMocks() jest.clearAllMocks()
mockLogger() mockLogger()
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true }) jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
jest.mock( jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, {
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"), virtual: true,
() => mockCodePackageJson, })
{ virtual: true },
)
constants = require("../../../src/node/constants") constants = require("../../../src/node/constants")
}) })
@ -96,7 +94,7 @@ describe("constants", () => {
const packageJson = constants.getPackageJson("../../package.json") const packageJson = constants.getPackageJson("../../package.json")
expect(packageJson).toStrictEqual(mockPackageJson) expect(packageJson).toStrictEqual(mockPackageJson)
const codePackageJson = constants.getPackageJson("../../vendor/modules/code-oss-dev/package.json") const codePackageJson = constants.getPackageJson("../../lib/vscode/package.json")
expect(codePackageJson).toStrictEqual(mockCodePackageJson) expect(codePackageJson).toStrictEqual(mockCodePackageJson)
}) })
}) })
@ -107,17 +105,15 @@ describe("constants", () => {
name: "mock-code-server", name: "mock-code-server",
} }
const mockCodePackageJson = { const mockCodePackageJson = {
name: "mock-code-oss-dev", name: "mock-vscode",
} }
beforeAll(() => { beforeAll(() => {
jest.clearAllMocks() jest.clearAllMocks()
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true }) jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
jest.mock( jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, {
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"), virtual: true,
() => mockCodePackageJson, })
{ virtual: true },
)
constants = require("../../../src/node/constants") constants = require("../../../src/node/constants")
}) })

View File

@ -103,7 +103,7 @@ describe("vscode", () => {
it("should do nothing when nothing is passed in", async () => { it("should do nothing when nothing is passed in", async () => {
codeServer = await integration.setup(["--auth=none"], "") codeServer = await integration.setup(["--auth=none"], "")
let resp = await codeServer.fetch("/", undefined) const resp = await codeServer.fetch("/", undefined)
expect(resp.status).toBe(200) expect(resp.status).toBe(200)
const url = new URL(resp.url) const url = new URL(resp.url)

View File

@ -20,7 +20,7 @@
"./node_modules/@types", "./node_modules/@types",
"./typings", "./typings",
"./test/node_modules/@types", "./test/node_modules/@types",
"./vendor/modules/code-oss-dev/src/vs/server/@types" "./lib/vscode/src/vs/server/@types"
], ],
"downlevelIteration": true "downlevelIteration": true
}, },

12
vendor/package.json vendored
View File

@ -1,12 +0,0 @@
{
"name": "vendor",
"version": "1.0.0",
"license": "MIT",
"private": true,
"scripts": {
"postinstall": "./postinstall.sh"
},
"devDependencies": {
"code-oss-dev": "coder/vscode#a13f6e1434ad6ab820eef0ecca5b923b3e275667"
}
}

10
vendor/postinstall.sh vendored
View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
echo 'Installing VS Code dependencies...'
cd modules/code-oss-dev
yarn install --frozen-lockfile
}
main "$@"

1519
vendor/yarn.lock vendored

File diff suppressed because it is too large Load Diff