From 58622ccc34ed879a709a25e00fec266c40fee4f4 Mon Sep 17 00:00:00 2001 From: Akash Satheesan Date: Tue, 1 Jun 2021 22:49:03 +0530 Subject: [PATCH] chore: update node to v14 (#3481) --- .github/workflows/ci.yaml | 32 ++++++++++++++++---------------- .tours/start-development.tour | 2 +- CHANGELOG.md | 1 + ci/build/npm-postinstall.sh | 23 ++++++++++++++++++++--- docs/CONTRIBUTING.md | 3 ++- docs/npm.md | 6 +++--- package.json | 4 ++-- yarn.lock | 8 ++++---- 8 files changed, 49 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ddbb5ff3..2229df08 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,10 +24,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - - name: Install Node.js v12 + - name: Install Node.js v14 uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14" - name: Install helm uses: azure/setup-helm@v1.1 @@ -67,10 +67,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - - name: Install Node.js v12 + - name: Install Node.js v14 uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14" - name: Fetch dependencies from cache id: cache-yarn @@ -96,10 +96,10 @@ jobs: with: fetch-depth: 0 - - name: Install Node.js v12 + - name: Install Node.js v14 uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14" - name: Fetch dependencies from cache id: cache-yarn @@ -169,10 +169,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Node.js v12 + - name: Install Node.js v14 uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14" - name: Install development tools run: | @@ -244,10 +244,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Node.js v12 + - name: Install Node.js v14 uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14" - name: Install nfpm run: | @@ -270,8 +270,8 @@ jobs: - name: Replace node with arm64 equivalent run: | - wget https://nodejs.org/dist/v12.18.4/node-v12.18.4-linux-arm64.tar.gz - tar -xzf node-v12.18.4-linux-arm64.tar.gz node-v12.18.4-linux-arm64/bin/node --strip-components=2 + wget https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-arm64.tar.xz + tar -xf node-v14.17.0-linux-arm64.tar.xz node-v14.17.0-linux-arm64/bin/node --strip-components=2 mv ./node ./release-standalone/lib/node - name: Build packages with nfpm @@ -290,10 +290,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Node.js v12 + - name: Install Node.js v14 uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14" - name: Install nfpm run: | @@ -333,10 +333,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install Node.js v12 + - name: Install Node.js v14 uses: actions/setup-node@v2 with: - node-version: "12" + node-version: "14" - name: Install playwright uses: microsoft/playwright-github-action@v1 diff --git a/.tours/start-development.tour b/.tours/start-development.tour index 4df15077..03f32927 100644 --- a/.tours/start-development.tour +++ b/.tours/start-development.tour @@ -5,7 +5,7 @@ { "file": "package.json", "line": 31, - "description": "## Commands\n\nTo start developing, make sure you have Node 12+ and the [required dependencies](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites) installed. Then, run the following commands:\n\n1. Install dependencies:\n>> yarn\n\n3. Start development mode (and watch for changes):\n>> yarn watch" + "description": "## Commands\n\nTo start developing, make sure you have Node 14+ and the [required dependencies](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites) installed. Then, run the following commands:\n\n1. Install dependencies:\n>> yarn\n\n3. Start development mode (and watch for changes):\n>> yarn watch" }, { "file": "src/node/app.ts", diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a7063fe..9163e909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ VS Code v0.00.0 ### Development - chore: cross-compile docker images with buildx #3166 @oxy +- chore: update node to v14 #3458 @oxy ## 3.10.2 diff --git a/ci/build/npm-postinstall.sh b/ci/build/npm-postinstall.sh index d266d438..761e46c1 100755 --- a/ci/build/npm-postinstall.sh +++ b/ci/build/npm-postinstall.sh @@ -23,10 +23,21 @@ main() { # Grabs the major version of node from $npm_config_user_agent which looks like # yarn/1.21.1 npm/? node/v14.2.0 darwin x64 major_node_version=$(echo "$npm_config_user_agent" | sed -n 's/.*node\/v\([^.]*\).*/\1/p') - if [ "$major_node_version" -lt 12 ]; then - echo "code-server currently requires at least node v12" + + if [ -n "${FORCE_NODE_VERSION:-}" ]; then + echo "WARNING: Overriding required Node.js version to v$FORCE_NODE_VERSION" + echo "This could lead to broken functionality, and is unsupported." + echo "USE AT YOUR OWN RISK!" + fi + + if [ "$major_node_version" -ne "${FORCE_NODE_VERSION:-14}" ]; then + echo "ERROR: code-server currently requires node v14." + if [ -n "$FORCE_NODE_VERSION" ]; then + echo "However, you have overrided the version check to use v$FORCE_NODE_VERSION." + fi echo "We have detected that you are on node v$major_node_version" - echo "See https://github.com/cdr/code-server/issues/1633" + echo "You can override this version check by setting \$FORCE_NODE_VERSION," + echo "but configurations that do not use the same node version are unsupported." exit 1 fi @@ -54,6 +65,12 @@ main() { echo "Please see https://github.com/cdr/code-server/blob/master/docs/npm.md" exit 1 fi + + if [ -n "${FORCE_NODE_VERSION:-}" ]; then + echo "WARNING: The required Node.js version was overriden to v$FORCE_NODE_VERSION" + echo "This could lead to broken functionality, and is unsupported." + echo "USE AT YOUR OWN RISK!" + fi } # This is a copy of symlink_asar in ../lib.sh. Look there for details. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 0da5bb1a..216b3ebf 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -35,7 +35,7 @@ The prerequisites for contributing to code-server are almost the same as those f [VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites). There are several differences, however. Here is what is needed: -- `node` v12.x or greater +- `node` v14.x or greater - `git` v2.x or greater - [`yarn`](https://classic.yarnpkg.com/en/) - used to install JS packages and run scripts @@ -74,6 +74,7 @@ To update VS Code, follow these steps: 4. There will be merge conflicts. First commit them. 1. We do this because if we don't, it will be impossible to review your PR. 5. Once they're all fixed, test code-server locally and make sure it all works. +6. Check the version of Node.js that the version of Electron shipped with VSCode uses, and update the version of Node.js if necessary. #### Notes about Changes diff --git a/docs/npm.md b/docs/npm.md index 4ef945fe..9386dd27 100644 --- a/docs/npm.md +++ b/docs/npm.md @@ -12,9 +12,9 @@ If you're installing the npm module you'll need certain dependencies to build the native modules used by VS Code. -- Node.js: version `>= 12`, `<= 14` +- Node.js: version `= 14`. Other versions may work, but your mileage may vary. -_Note: the Node.js version requirements are based on the VS Code Node.js requirements. See [here](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)._ +_Note: We use the same major version of Node.js that is shipped in VSCode's Electron. VS Code also lists Node.js requirements. See [here](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)._ Related: @@ -55,6 +55,6 @@ xcode-select --install ## FreeBSD ```sh -pkg install -y git python npm-node12 yarn-node12 pkgconf +pkg install -y git python npm-node14 yarn-node14 pkgconf pkg install -y libinotify ``` diff --git a/package.json b/package.json index 22d70a07..12786f4f 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@types/express": "^4.17.8", "@types/http-proxy": "^1.17.4", "@types/js-yaml": "^4.0.0", - "@types/node": "~12.20.7", + "@types/node": "^14.17.1", "@types/parcel-bundler": "^1.12.1", "@types/pem": "^1.9.5", "@types/proxy-from-env": "^1.0.1", @@ -123,7 +123,7 @@ "browser-ide" ], "engines": { - "node": ">= 12 <= 14" + "node": "= 14" }, "jest": { "transform": { diff --git a/yarn.lock b/yarn.lock index dff93780..d9bc1329 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1126,10 +1126,10 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256" integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg== -"@types/node@*", "@types/node@~12.20.7": - version "12.20.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.13.tgz#e743bae112bd779ac9650f907197dd2caa7f0364" - integrity sha512-1x8W5OpxPq+T85OUsHRP6BqXeosKmeXRtjoF39STcdf/UWLqUsoehstZKOi0CunhVqHG17AyZgpj20eRVooK6A== +"@types/node@*", "@types/node@^14.17.1": + version "14.17.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.17.1.tgz#5e07e0cb2ff793aa7a1b41deae76221e6166049f" + integrity sha512-/tpUyFD7meeooTRwl3sYlihx2BrJE7q9XF71EguPFIySj9B7qgnRtHsHTho+0AUm4m1SvWGm6uSncrR94q6Vtw== "@types/normalize-package-data@^2.4.0": version "2.4.0"