Skip to content

Commit

Permalink
Update to Node 18 (github#34001)
Browse files Browse the repository at this point in the history
  • Loading branch information
heiskr authored Jan 23, 2023
1 parent 4a6d3b4 commit f39c19e
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/javascript-node/.devcontainer/base.Dockerfile
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/blob/main/containers/javascript-node/.devcontainer/base.Dockerfile

# [Choice] Node.js version: 16, 14, 12
ARG VARIANT="16-buster"
# [Choice] Node.js version
ARG VARIANT="18-buster"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"name": "docs.github.com",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 12, 14, 16
"args": { "VARIANT": "16" }
// Update 'VARIANT' to pick a Node version
"args": { "VARIANT": "18" }
},

// Set *default* container specific settings.json values on container create.
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/node-npm-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ runs:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }}

- name: Setup node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/azure-prod-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:
# To prevent issues with cloning early access content later
persist-credentials: 'false'

- name: Setup node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Clone docs-early-access
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/azure-staging-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ jobs:
# Image tag is unique to each workflow run so that it always triggers a new deployment
echo "DOCKER_IMAGE=${{ secrets.NONPROD_REGISTRY_SERVER }}/${{ env.IMAGE_REPO }}:${{ env.COMMIT_REF }}-${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
- name: Setup node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Clone docs-early-access
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/browser-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ jobs:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/content-changes-table-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ jobs:
APP_NAME_SEED: ${{ secrets.PREVIEW_ENV_NAME_SEED }}
run: .github/actions-scripts/get-preview-app-info.sh

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Install temporary dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-review-collect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Check out repo content
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/os-ready-for-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
- name: Check out repo content
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Install dependencies
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/package-lock-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ jobs:
- name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Run check
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ready-for-doc-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
- name: Check out repo content
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

- name: Setup Node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm

- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/repo-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ jobs:
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8

# Set up npm and run npm ci to get custom husky githooks error
# messages if they exist. We could also remove these two steps
# messages if they exist. We could also remove these steps
# because currently we have no hooks with customer error messages.
# See pull #32064 where they were removed.
- name: Setup node
- name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with:
node-version: '16.17.0'
node-version-file: '.node-version'
cache: npm
- name: Install dependencies
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.2.0
18.13.0
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ For more information about using a codespace for working on GitHub documentation
- Using the command line:
- [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#fork-an-example-repository) so that you can make your changes without affecting the original project until you're ready to merge them.

2. Install or update to **Node.js v16**. For more information, see [the development guide](contributing/development.md).
2. Install or update to **Node.js**, at the version specified in `.node-version`. For more information, see [the development guide](contributing/development.md).

3. Create a working branch and start with your changes!

Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# --------------------------------------------------------------------------------
# BASE IMAGE
# --------------------------------------------------------------------------------
FROM node:16.18.0-alpine@sha256:f16544bc93cf1a36d213c8e2efecf682e9f4df28429a629a37aaf38ecfc25cf4 as base
# To update the sha, run `docker pull node:$VERSION-alpine`
# look for something like: `Digest: sha256:0123456789abcdef`
FROM node:18.13.0-alpine@sha256:fda98168118e5a8f4269efca4101ee51dd5c75c0fe56d8eb6fad80455c2f5827 as base

# This directory is owned by the node user
ARG APP_HOME=/home/node/app
Expand All @@ -24,7 +26,7 @@ COPY --chown=node:node package.json package-lock.json ./
RUN npm ci --no-optional --registry https://registry.npmjs.org/

# For Next.js v12+
# This the appropriate necessary extra for node:16-alpine
# This the appropriate necessary extra for node:VERSION-alpine
# Other options are https://www.npmjs.com/search?q=%40next%2Fswc
RUN npm i @next/swc-linux-x64-musl --no-save

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.openapi_decorator
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine
FROM node:18.13.0-alpine

RUN apk add --no-cache git python make g++

Expand Down
2 changes: 1 addition & 1 deletion contributing/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This site is powered by Node.js! :sparkles: :turtle: :rocket: :sparkles:

It runs on macOS, Windows, and Linux environments.

You'll need Node.js version 16 to run the site. To install Node.js, [download the "LTS" installer from nodejs.org](https://nodejs.org). If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](https://github.com/nodenv/nodenv#readme) for instructions on switching Node.js versions.
You'll need Node.js to run the site. Check the version in `.node-version`. To install Node.js, [download the "LTS" installer from nodejs.org](https://nodejs.org). If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](https://github.com/nodenv/nodenv#readme) for instructions on switching Node.js versions.

Once you've installed Node.js (which includes the popular `npm` package manager), open Terminal and run the following:

Expand Down
9 changes: 4 additions & 5 deletions contributing/node-versions.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Node Versions

In [development](contributing/development.md) environments this site will run on Node.js versions `12 - 14`.

In [staging and production](contributing/deployments.md) environments this site runs on Node.js 14, the [Active LTS version](https://nodejs.org/en/about/releases/) from 2020-10-27 to 2021-10-26).
This site will run on the Node.js version specified in `.node-version`.

When updating to a new Node.js version, consider the following files:

Expand Down Expand Up @@ -32,10 +30,11 @@ sudo chown -R $(whoami) /usr/local/sbin

If you're using another operating system, or did not use Homebrew to install nodenv, see these [upgrade instructions](https://github.com/nodenv/nodenv#installation).

To install Node.js 14 and make it your default version, run this command:
To install Node.js and make it your default version, run this command:

```sh
nodenv install 14.13.0 && nodenv global 14.13.0
VERSION=`cat .node-version`
nodenv install $VERSION && nodenv global $VERSION
```

You may sometimes see a warning when running npm scripts with nodenv:
Expand Down

0 comments on commit f39c19e

Please sign in to comment.