mirror of https://github.com/coder/code-server.git
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:
parent
184ef68147
commit
21c74802e8
|
@ -29,6 +29,9 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -38,21 +41,17 @@ jobs:
|
|||
- name: Install helm
|
||||
uses: azure/setup-helm@v1.1
|
||||
|
||||
# NOTE@jsjoeio
|
||||
# disabling this until we can audit the build process
|
||||
# and the usefulness of this step
|
||||
# See: https://github.com/coder/code-server/issues/4287
|
||||
# - name: Fetch dependencies from cache
|
||||
# id: cache-yarn
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: "**/node_modules"
|
||||
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
# restore-keys: |
|
||||
# yarn-build-
|
||||
- name: Fetch dependencies from cache
|
||||
id: cache-yarn
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
yarn-build-
|
||||
|
||||
- name: Install dependencies
|
||||
# if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
- name: Run yarn fmt
|
||||
|
@ -71,6 +70,9 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -102,56 +104,49 @@ jobs:
|
|||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
# TODO@Teffen investigate why this omits code-oss-dev/node_modules
|
||||
# - name: Fetch dependencies from cache
|
||||
# id: cache-yarn
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: |
|
||||
# "**/node_modules"
|
||||
# "**/vendor/modules"
|
||||
# "**/vendor/modules/code-oss-dev/node_modules"
|
||||
# key: yarn-build-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/vendor/yarn.lock') }}
|
||||
# restore-keys: |
|
||||
# yarn-build-
|
||||
- name: Fetch dependencies from cache
|
||||
id: cache-yarn
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "**/node_modules"
|
||||
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
yarn-build-
|
||||
|
||||
- name: Install dependencies
|
||||
# if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
if: steps.cache-yarn.outputs.cache-hit != 'true'
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
- name: Build code-server
|
||||
run: yarn build
|
||||
|
||||
# Parse the hash of the latest commit inside vendor/modules/code-oss-dev
|
||||
# use this to avoid rebuilding it if nothing changed
|
||||
# How it works: the `git log` command fetches the hash of the last commit
|
||||
# that changed a file inside `vendor/modules/code-oss-dev`. If a commit changes any file in there,
|
||||
# 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
|
||||
# Get Code's git hash. When this changes it means the content is
|
||||
# different and we need to rebuild. Use VSCODE_CACHE_VERSION to force a
|
||||
# rebuild.
|
||||
- name: Get latest lib/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
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
vendor/modules/code-oss-dev/.build
|
||||
vendor/modules/code-oss-dev/package.json
|
||||
vendor/modules/code-oss-dev/out-build
|
||||
vendor/modules/code-oss-dev/out-vscode-reh-web
|
||||
vendor/modules/code-oss-dev/out-vscode-reh-web-min
|
||||
lib/vscode/.build
|
||||
lib/vscode/out-build
|
||||
lib/vscode/out-vscode-reh-web
|
||||
lib/vscode/out-vscode-reh-web-min
|
||||
key: vscode-reh-build-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}
|
||||
|
||||
- name: Build vscode
|
||||
|
@ -197,7 +192,10 @@ jobs:
|
|||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/download-artifact@v3
|
||||
id: download
|
||||
|
@ -226,7 +224,10 @@ jobs:
|
|||
container: "centos:7"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -315,7 +316,10 @@ jobs:
|
|||
NODE_VERSION: v14.17.4
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -364,7 +368,10 @@ jobs:
|
|||
runs-on: macos-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -409,7 +416,11 @@ jobs:
|
|||
# since VS Code will load faster due to the bundling.
|
||||
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Install Node.js v14
|
||||
uses: actions/setup-node@v3
|
||||
|
@ -446,12 +457,6 @@ jobs:
|
|||
./test/node_modules/.bin/playwright install-deps
|
||||
./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
|
||||
run: yarn test:e2e
|
||||
|
||||
|
@ -468,8 +473,11 @@ jobs:
|
|||
trivy-scan-repo:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run Trivy vulnerability scanner in repo mode
|
||||
uses: aquasecurity/trivy-action@296212627a1e693efa09c00adc3e03b2ba8edf18
|
||||
with:
|
||||
|
@ -480,6 +488,7 @@ jobs:
|
|||
template: "@/contrib/sarif.tpl"
|
||||
output: "trivy-repo-results.sarif"
|
||||
severity: "HIGH,CRITICAL"
|
||||
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "lib/vscode"]
|
||||
path = lib/vscode
|
||||
url = https://github.com/coder/vscode
|
|
@ -7,7 +7,7 @@ useTabs: false
|
|||
|
||||
overrides:
|
||||
# Attempt to keep VScode's existing code style intact.
|
||||
- files: "vendor/modules/code-oss-dev/**/*.ts"
|
||||
- files: "lib/vscode/**/*.ts"
|
||||
options:
|
||||
# No limit defined upstream.
|
||||
printWidth: 10000
|
||||
|
|
|
@ -143,7 +143,7 @@
|
|||
"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,
|
||||
"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."
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ main() {
|
|||
|
||||
source ./ci/lib.sh
|
||||
|
||||
VSCODE_SRC_PATH="vendor/modules/code-oss-dev"
|
||||
VSCODE_OUT_PATH="$RELEASE_PATH/vendor/modules/code-oss-dev"
|
||||
VSCODE_SRC_PATH="lib/vscode"
|
||||
VSCODE_OUT_PATH="$RELEASE_PATH/lib/vscode"
|
||||
|
||||
mkdir -p "$RELEASE_PATH"
|
||||
|
||||
|
@ -25,7 +25,7 @@ main() {
|
|||
|
||||
rsync ./docs/README.md "$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() {
|
||||
|
|
|
@ -33,8 +33,7 @@ main() {
|
|||
# HACK: the version of Typescript vscode 1.57 uses in extensions/
|
||||
# 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/vendor/modules/code-oss-dev/extensions/node_modules/.bin"
|
||||
rm -fr "$RELEASE_PATH/lib/vscode/extensions/node_modules/.bin"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
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=${MINIFY-true}
|
||||
|
@ -9,7 +9,7 @@ MINIFY=${MINIFY-true}
|
|||
main() {
|
||||
cd "$(dirname "${0}")/../.."
|
||||
|
||||
cd vendor/modules/code-oss-dev
|
||||
cd lib/vscode
|
||||
|
||||
# Any platform works since we have our own packaging step (for now).
|
||||
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"
|
||||
|
|
|
@ -90,8 +90,8 @@ symlink_asar() {
|
|||
}
|
||||
|
||||
vscode_yarn() {
|
||||
echo 'Installing vendor dependencies...'
|
||||
cd vendor/modules/code-oss-dev
|
||||
echo 'Installing Code dependencies...'
|
||||
cd lib/vscode
|
||||
yarn --production --frozen-lockfile
|
||||
|
||||
symlink_asar
|
||||
|
|
|
@ -19,7 +19,7 @@ main() {
|
|||
"*.sh"
|
||||
)
|
||||
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
|
||||
|
|
|
@ -4,10 +4,10 @@ set -euo pipefail
|
|||
main() {
|
||||
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")
|
||||
stylelint $(git ls-files "*.css" | 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 "lib/vscode")
|
||||
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
|
||||
helm kubeval ci/helm-chart
|
||||
fi
|
||||
|
|
|
@ -1,50 +1,32 @@
|
|||
#!/usr/bin/env bash
|
||||
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() {
|
||||
cd "$(dirname "$0")/../.."
|
||||
source ./ci/lib.sh
|
||||
|
||||
pushd test
|
||||
echo "Installing dependencies for $PWD"
|
||||
yarn install
|
||||
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
|
||||
install-deps test
|
||||
install-deps test/e2e/extensions/test-extension
|
||||
install-deps lib/vscode
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
@ -37,7 +37,7 @@ main() {
|
|||
exit 1
|
||||
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"
|
||||
help
|
||||
exit 1
|
||||
|
|
|
@ -14,7 +14,7 @@ main() {
|
|||
# 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
|
||||
# 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 target="out-build"
|
||||
if [[ ! -e $link ]] && [[ -d $vscode/$target ]]; then
|
||||
|
|
|
@ -14,7 +14,7 @@ class Watcher {
|
|||
private rootPath = path.resolve(process.cwd())
|
||||
private readonly paths = {
|
||||
/** 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,
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ pkg_json_version() {
|
|||
}
|
||||
|
||||
vscode_version() {
|
||||
jq -r .version vendor/modules/code-oss-dev/package.json
|
||||
jq -r .version lib/vscode/package.json
|
||||
}
|
||||
|
||||
os() {
|
||||
|
|
|
@ -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:
|
||||
|
||||
1. `git clone https://github.com/coder/code-server.git` - Clone `code-server`
|
||||
2. `git clone https://github.com/coder/vscode.git` - Clone `vscode`
|
||||
3. `cd vscode && yarn install` - install the dependencies in the `vscode` repo
|
||||
4. `cd code-server && yarn install` - install the dependencies in the `code-server` repo
|
||||
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.
|
||||
2. `git submodule update --init` - Clone `vscode` submodule
|
||||
3. `yarn` - Install dependencies
|
||||
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.
|
||||
|
||||
### 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:
|
||||
|
||||
1. Update the package tag listed in `vendor/package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"devDependencies": {
|
||||
"vscode": "coder/vscode#<latest-commit-sha>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
1. Update the `lib/vscode` submodule to the latest `main`.
|
||||
2. From the code-server **project root**, run `yarn install`.
|
||||
Then, 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
|
||||
3. Test code-server locally to make sure everything works.
|
||||
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.
|
||||
4. 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`.
|
||||
5. Commit the updated submodule to `code-server`.
|
||||
6. Open a PR.
|
||||
|
||||
### 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).
|
||||
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
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
|
||||
[vendor/modules/code-oss-dev](../vendor/modules/code-oss-dev).
|
||||
[lib/vscode](../lib/vscode).
|
||||
|
||||
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
|
||||
- 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)
|
||||
- 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`](../lib/vscode/build/lib/node.ts) and [`build/lib/util.ts`](../lib/vscode/build/lib/util.ts)
|
||||
- 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 environment state to [`src/vs/platform/environment/common/environment.ts`](../vendor/modules/code-oss-dev/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 scanning paths to [`src/vs/platform/extensionManagement/node/extensionsScanner.ts`](../vendor/modules/code-oss-dev/src/vs/platform/extensionManagement/node/extensionsScanner.ts)
|
||||
- Additions/removals from [`package.json`](../vendor/modules/code-oss-dev/package.json):
|
||||
- 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`](../lib/vscode/src/vs/platform/environment/common/environment.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`](../lib/vscode/src/vs/platform/extensionManagement/node/extensionsScanner.ts)
|
||||
- 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 `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 our branding/custom URLs/version:
|
||||
- [`product.json`](../vendor/modules/code-oss-dev/product.json)
|
||||
- [`src/vs/base/common/product.ts`](../vendor/modules/code-oss-dev/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/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/welcomePage.ts`](../vendor/modules/code-oss-dev/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)
|
||||
- [`product.json`](../lib/vscode/product.json)
|
||||
- [`src/vs/base/common/product.ts`](../lib/vscode/src/vs/base/common/product.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`](../lib/vscode/src/vs/workbench/contrib/welcome/page/browser/vs_code_welcome_page.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`](../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).
|
||||
- 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/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/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)
|
||||
- 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)
|
||||
- [`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`](../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`](../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`](../lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts)
|
||||
- We use this for connection persistence in our server-side code.
|
||||
- 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
|
||||
- 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
|
||||
- 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)
|
||||
- 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 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 `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)
|
||||
- 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`](../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`](../lib/vscode/src/vs/platform/remote/common/remoteAgentConnection.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:
|
||||
- Added file [`src/vs/workbench/services/localizations/browser/localizationsService.ts`](../vendor/modules/code-oss-dev/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/node/languagePacks.js`](../vendor/modules/code-oss-dev/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 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`](../lib/vscode/src/vs/base/common/platform.ts)
|
||||
- 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`](../lib/vscode/src/vs/platform/product/common/product.ts)
|
||||
- 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)
|
||||
- Remove broken symlinks in [`extensions/postinstall.js`](../vendor/modules/code-oss-dev/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)
|
||||
- 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)
|
||||
- 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)
|
||||
- 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 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)
|
||||
- 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)
|
||||
- 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)
|
||||
- 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)
|
||||
- Specify webview path 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`](../vendor/modules/code-oss-dev/src/vs/code/browser/workbench/workbench.ts)
|
||||
- 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`](../lib/vscode/extensions/postinstall.js)
|
||||
- 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`](../lib/vscode/extensions/github-authentication/src/githubServer.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`](../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`](../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`](../lib/vscode/build/lib/extensions.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`](../lib/vscode/src/vs/platform/storage/common/storage.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`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
|
||||
- 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/platform/remote/browser/browserSocketFactory.ts`](../vendor/modules/code-oss-dev/src/vs/platform/remote/browser/browserSocketFactory.ts)
|
||||
- [`src/vs/base/common/network.ts`](../vendor/modules/code-oss-dev/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)
|
||||
- [`src/vs/code/browser/workbench/workbench.ts`](../lib/vscode/src/vs/code/browser/workbench/workbench.ts)
|
||||
- [`src/vs/platform/remote/browser/browserSocketFactory.ts`](../lib/vscode/src/vs/platform/remote/browser/browserSocketFactory.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`](../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
|
||||
eliminate our modifications. In the meantime, upgrading the VS Code version requires
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit a13f6e1434ad6ab820eef0ecca5b923b3e275667
|
|
@ -127,7 +127,6 @@
|
|||
"testEnvironment": "node",
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"/vendor/",
|
||||
"/lib/",
|
||||
"/out/",
|
||||
"test/e2e"
|
||||
|
@ -158,7 +157,7 @@
|
|||
"<rootDir>/release-npm-package",
|
||||
"<rootDir>/release-gcp",
|
||||
"<rootDir>/release-images",
|
||||
"<rootDir>/vendor"
|
||||
"<rootDir>/lib"
|
||||
],
|
||||
"moduleNameMapper": {
|
||||
"^.+\\.(css|less)$": "<rootDir>/test/utils/cssStub.ts"
|
||||
|
|
|
@ -17,7 +17,7 @@ export function getPackageJson(relativePath: string): JSONSchemaForNPMPackageJso
|
|||
}
|
||||
|
||||
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 pkg = getPackageJson(`${rootPath}/${PACKAGE_JSON}`)
|
||||
const codePkg = getPackageJson(`${vsRootPath}/${PACKAGE_JSON}`) || { version: "0.0.0" }
|
||||
|
|
|
@ -31,7 +31,7 @@ export const shouldSpawnCliProcess = (args: UserProvidedArgs): boolean => {
|
|||
export const runVsCodeCli = async (args: DefaultedArgs): Promise<void> => {
|
||||
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")
|
||||
|
||||
try {
|
||||
|
|
|
@ -118,7 +118,7 @@ export class CodeServerRouteWrapper {
|
|||
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")
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { logger } from "@coder/logger"
|
||||
import { mockLogger } from "../../utils/helpers"
|
||||
import * as semver from "semver"
|
||||
import path from "path"
|
||||
import * as semver from "semver"
|
||||
import { mockLogger } from "../../utils/helpers"
|
||||
|
||||
describe("constants", () => {
|
||||
let constants: typeof import("../../../src/node/constants")
|
||||
|
@ -16,7 +16,7 @@ describe("constants", () => {
|
|||
}
|
||||
|
||||
const mockCodePackageJson = {
|
||||
name: "mock-code-oss-dev",
|
||||
name: "mock-vscode",
|
||||
version: "1.2.3",
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,9 @@ describe("constants", () => {
|
|||
jest.clearAllMocks()
|
||||
mockLogger()
|
||||
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
|
||||
jest.mock(
|
||||
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"),
|
||||
() => mockCodePackageJson,
|
||||
{ virtual: true },
|
||||
)
|
||||
jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, {
|
||||
virtual: true,
|
||||
})
|
||||
constants = require("../../../src/node/constants")
|
||||
})
|
||||
|
||||
|
@ -96,7 +94,7 @@ describe("constants", () => {
|
|||
const packageJson = constants.getPackageJson("../../package.json")
|
||||
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)
|
||||
})
|
||||
})
|
||||
|
@ -107,17 +105,15 @@ describe("constants", () => {
|
|||
name: "mock-code-server",
|
||||
}
|
||||
const mockCodePackageJson = {
|
||||
name: "mock-code-oss-dev",
|
||||
name: "mock-vscode",
|
||||
}
|
||||
|
||||
beforeAll(() => {
|
||||
jest.clearAllMocks()
|
||||
jest.mock(path.resolve(__dirname, "../../../package.json"), () => mockPackageJson, { virtual: true })
|
||||
jest.mock(
|
||||
path.resolve(__dirname, "../../../vendor/modules/code-oss-dev/package.json"),
|
||||
() => mockCodePackageJson,
|
||||
{ virtual: true },
|
||||
)
|
||||
jest.mock(path.resolve(__dirname, "../../../lib/vscode/package.json"), () => mockCodePackageJson, {
|
||||
virtual: true,
|
||||
})
|
||||
constants = require("../../../src/node/constants")
|
||||
})
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ describe("vscode", () => {
|
|||
it("should do nothing when nothing is passed in", async () => {
|
||||
codeServer = await integration.setup(["--auth=none"], "")
|
||||
|
||||
let resp = await codeServer.fetch("/", undefined)
|
||||
const resp = await codeServer.fetch("/", undefined)
|
||||
|
||||
expect(resp.status).toBe(200)
|
||||
const url = new URL(resp.url)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"./node_modules/@types",
|
||||
"./typings",
|
||||
"./test/node_modules/@types",
|
||||
"./vendor/modules/code-oss-dev/src/vs/server/@types"
|
||||
"./lib/vscode/src/vs/server/@types"
|
||||
],
|
||||
"downlevelIteration": true
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -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 "$@"
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue