1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Update to Node 18 (#34001)

This commit is contained in:
Kevin Heis
2023-01-23 08:00:25 -08:00
committed by GitHub
parent 4a6d3b4e89
commit f39c19e05b
18 changed files with 39 additions and 37 deletions

View File

@@ -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 # [Choice] Node.js version
ARG VARIANT="16-buster" ARG VARIANT="18-buster"
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}
# [Optional] Uncomment this section to install additional OS packages. # [Optional] Uncomment this section to install additional OS packages.

View File

@@ -5,8 +5,8 @@
"name": "docs.github.com", "name": "docs.github.com",
"build": { "build": {
"dockerfile": "Dockerfile", "dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 12, 14, 16 // Update 'VARIANT' to pick a Node version
"args": { "VARIANT": "16" } "args": { "VARIANT": "18" }
}, },
// Set *default* container specific settings.json values on container create. // Set *default* container specific settings.json values on container create.

View File

@@ -11,10 +11,10 @@ runs:
path: node_modules path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }} key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }}
- name: Setup node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Install dependencies - name: Install dependencies

View File

@@ -55,10 +55,10 @@ jobs:
# To prevent issues with cloning early access content later # To prevent issues with cloning early access content later
persist-credentials: 'false' persist-credentials: 'false'
- name: Setup node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Clone docs-early-access - name: Clone docs-early-access

View File

@@ -73,10 +73,10 @@ jobs:
# Image tag is unique to each workflow run so that it always triggers a new deployment # 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 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 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Clone docs-early-access - name: Clone docs-early-access

View File

@@ -51,10 +51,10 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup Node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Install dependencies - name: Install dependencies

View File

@@ -56,10 +56,10 @@ jobs:
APP_NAME_SEED: ${{ secrets.PREVIEW_ENV_NAME_SEED }} APP_NAME_SEED: ${{ secrets.PREVIEW_ENV_NAME_SEED }}
run: .github/actions-scripts/get-preview-app-info.sh run: .github/actions-scripts/get-preview-app-info.sh
- name: Setup Node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Install temporary dependencies - name: Install temporary dependencies

View File

@@ -22,10 +22,10 @@ jobs:
- name: Check out repo content - name: Check out repo content
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup Node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Install dependencies - name: Install dependencies

View File

@@ -46,10 +46,10 @@ jobs:
- name: Check out repo content - name: Check out repo content
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup Node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Install dependencies - name: Install dependencies

View File

@@ -27,10 +27,11 @@ jobs:
- name: Check out repo - name: Check out repo
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup Node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm
- name: Run check - name: Run check
run: | run: |

View File

@@ -22,10 +22,10 @@ jobs:
- name: Check out repo content - name: Check out repo content
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup Node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Install dependencies - name: Install dependencies

View File

@@ -101,13 +101,13 @@ jobs:
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
# Set up npm and run npm ci to get custom husky githooks error # 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. # because currently we have no hooks with customer error messages.
# See pull #32064 where they were removed. # See pull #32064 where they were removed.
- name: Setup node - name: Setup Node.js
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516
with: with:
node-version: '16.17.0' node-version-file: '.node-version'
cache: npm cache: npm
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci

View File

@@ -1 +1 @@
16.2.0 18.13.0

View File

@@ -56,7 +56,7 @@ For more information about using a codespace for working on GitHub documentation
- Using the command line: - 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. - [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! 3. Create a working branch and start with your changes!

View File

@@ -3,7 +3,9 @@
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------
# BASE IMAGE # 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 # This directory is owned by the node user
ARG APP_HOME=/home/node/app ARG APP_HOME=/home/node/app
@@ -24,7 +26,7 @@ COPY --chown=node:node package.json package-lock.json ./
RUN npm ci --no-optional --registry https://registry.npmjs.org/ RUN npm ci --no-optional --registry https://registry.npmjs.org/
# For Next.js v12+ # 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 # Other options are https://www.npmjs.com/search?q=%40next%2Fswc
RUN npm i @next/swc-linux-x64-musl --no-save RUN npm i @next/swc-linux-x64-musl --no-save

View File

@@ -1,4 +1,4 @@
FROM node:14-alpine FROM node:18.13.0-alpine
RUN apk add --no-cache git python make g++ RUN apk add --no-cache git python make g++

View File

@@ -8,7 +8,7 @@ This site is powered by Node.js! :sparkles: :turtle: :rocket: :sparkles:
It runs on macOS, Windows, and Linux environments. 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: Once you've installed Node.js (which includes the popular `npm` package manager), open Terminal and run the following:

View File

@@ -1,8 +1,6 @@
# Node Versions # Node Versions
In [development](contributing/development.md) environments this site will run on Node.js versions `12 - 14`. This site will run on the Node.js version specified in `.node-version`.
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).
When updating to a new Node.js version, consider the following files: When updating to a new Node.js version, consider the following files:
@@ -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). 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 ```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: You may sometimes see a warning when running npm scripts with nodenv: