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

Upgrade to Node.js 14 (#15822)

* set engines.node to >=12

* set engines.node to >=12

* Update node-versions.md

* update Node.js version in Actions workflows

* Update .node-version

* Update references to Node.js version from 12 to 14

* Update Dockerfile to use Node.js 14

* set engines.node to safe "12 - 14" range
This commit is contained in:
Zeke Sikelianos
2020-10-05 17:02:55 -07:00
committed by GitHub
parent 6f5edb73ad
commit b22914db59
9 changed files with 36 additions and 54 deletions

View File

@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: "12.x" node-version: 14.x
- name: cache node modules - name: cache node modules
uses: actions/cache@v1 uses: actions/cache@v1
with: with:

View File

@@ -19,7 +19,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 14.x
- name: Get npm cache directory - name: Get npm cache directory
id: npm-cache id: npm-cache
@@ -57,7 +57,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 14.x
- name: Get npm cache directory - name: Get npm cache directory
id: npm-cache id: npm-cache

View File

@@ -20,7 +20,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 14.x
- name: Get npm cache directory - name: Get npm cache directory
id: npm-cache id: npm-cache
@@ -58,7 +58,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 14.x
- name: Get npm cache directory - name: Get npm cache directory
id: npm-cache id: npm-cache

View File

@@ -23,7 +23,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 14.x
- name: Get npm cache directory - name: Get npm cache directory
id: npm-cache id: npm-cache
@@ -60,7 +60,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: 14.x
- name: Get npm cache directory - name: Get npm cache directory
id: npm-cache id: npm-cache

View File

@@ -1 +1 @@
12.8.0 14.13.0

View File

@@ -6,7 +6,7 @@
# INSTALLATION IMAGE # INSTALLATION IMAGE
# A temporary image that installs production-only dependencies # A temporary image that installs production-only dependencies
FROM node:12-alpine as installation FROM node:14-alpine as installation
ENV NODE_ENV production ENV NODE_ENV production
WORKDIR /usr/src/docs WORKDIR /usr/src/docs
COPY package*.json ./ COPY package*.json ./
@@ -18,7 +18,7 @@ RUN npm ci
# BUNDLE IMAGE # BUNDLE IMAGE
# A temporary image that installs dependencies and builds the production-ready front-end bundles. # A temporary image that installs dependencies and builds the production-ready front-end bundles.
FROM node:12-alpine as bundles FROM node:14-alpine as bundles
WORKDIR /usr/src/docs WORKDIR /usr/src/docs
# Install the files used to create the bundles # Install the files used to create the bundles
COPY package*.json ./ COPY package*.json ./
@@ -32,7 +32,7 @@ RUN npm ci && npm run build
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------
# MAIN IMAGE # MAIN IMAGE
FROM node:12-alpine FROM node:14-alpine
# Let's make our home # Let's make our home
WORKDIR /usr/src/docs WORKDIR /usr/src/docs

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 v12** to run the site. If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](#nodenv) below for instructions on switching to Node.js 12. If you're not using `nodenv`, the best way to install Node.js is to [download the LTS installer from nodejs.org](https://nodejs.org). You'll need **Node.js v14** to run the site. If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](#nodenv) for instructions on switching Node.js versions. If you're not using `nodenv`, the best way to install Node.js is to [download the LTS installer from nodejs.org](https://nodejs.org).
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:
@@ -52,26 +52,4 @@ For more info about working with this site, check out these READMEs:
- [middleware/README.md](../middleware/README.md) - [middleware/README.md](../middleware/README.md)
- [script/README.md](../script/README.md) - [script/README.md](../script/README.md)
- [stylesheets/README.md](../stylesheets/README.md) - [stylesheets/README.md](../stylesheets/README.md)
- [tests/README.md](../tests/README.md) - [tests/README.md](../tests/README.md)
## `nodenv`
[nodenv](https://github.com/nodenv/nodenv) is a tool for managing multiple Node.js versions on your local machine. It is **not required** to run this app, but you may already have it installed if you've worked on other projects that use Node.js.
To install Node.js 12 and make it your default version, run this command:
```sh
nodenv install 12.8.0 && nodenv global 12.8.0
```
You may sometimes see a warning when running npm scripts with nodenv:
```sh
npm WARN lifecycle The node binary used for scripts is [...] but npm is using [...]
```
This is due to nodenv's overriding behavior. To silence this harmless warning, the [nodenv docs](https://github.com/nodenv/nodenv/wiki/FAQ#npm-warning-about-mismatched-binaries) recommend running the following command from any directory:
```sh
npm config set scripts-prepend-node-path auto
```

View File

@@ -1,26 +1,32 @@
## Node Versions # Node Versions
The site currently runs on Node.js v12, the [Active LTS version](https://nodejs.org/en/about/releases/) that will be supported until 2020-10-20. The site currently runs on Node.js v14, 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:
- The `engines.node` entry in `package.json` - [ ] The `engines.node` entry in `package.json`
- The `.node-version` file used by [nodenv](https://github.com/nodenv/nodenv), a tool for managing multiple Node.js versions on your machine. - [ ] The `.node-version` file used by [nodenv](https://github.com/nodenv/nodenv), a tool for managing multiple Node.js versions on your machine.
- The `.github/*.workflow` Actions files - [ ] The `.github/*.workflow` Actions files
- The `Dockerfile` that can be used for deployments - [ ] The `Dockerfile` that can be used for deployments
- This README! - [ ] The `contributing/development.md` guide
- [ ] The `contributing/node-versions.md` file
### `nodenv` ## `nodenv`
[nodenv](https://github.com/nodenv/nodenv) is a tool for managing multiple [nodenv](https://github.com/nodenv/nodenv) is a tool for managing multiple Node.js versions on your local machine. It is **not required** to run this app, but you may already have it installed if you've worked on other projects that use Node.js.
Node.js versions on your local machine. It is **not required** to run the
docs-internal app, but you may already have it installed if you've worked on other
internal GitHub projects that use Node.js.
To install Node.js 12 and make it your default version, run this command: If you're using macOS, run this command to get the latest:
```
brew upgrade nodenv node-build
```
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:
```sh ```sh
nodenv install 12.8.0 && nodenv global 12.8.0 nodenv install 14.13.0 && nodenv global 14.13.0
``` ```
You may sometimes see a warning when running npm scripts with nodenv: You may sometimes see a warning when running npm scripts with nodenv:
@@ -29,10 +35,8 @@ You may sometimes see a warning when running npm scripts with nodenv:
npm WARN lifecycle The node binary used for scripts is [...] but npm is using [...] npm WARN lifecycle The node binary used for scripts is [...] but npm is using [...]
``` ```
This is due to nodenv's overriding behavior. To silence this harmless warning, This is due to nodenv's overriding behavior. To silence this harmless warning, the [nodenv docs](https://github.com/nodenv/nodenv/wiki/FAQ#npm-warning-about-mismatched-binaries) recommend running the following command from any directory:
the [nodenv docs](https://github.com/nodenv/nodenv/wiki/FAQ#npm-warning-about-mismatched-binaries)
recommend running the following command from any directory:
```sh ```sh
npm config set scripts-prepend-node-path auto npm config set scripts-prepend-node-path auto
``` ```

View File

@@ -140,7 +140,7 @@
"pa11y-test": "start-server-and-test browser-test-server 4001 pa11y-ci" "pa11y-test": "start-server-and-test browser-test-server 4001 pa11y-ci"
}, },
"engines": { "engines": {
"node": "8 - 12" "node": "12 - 14"
}, },
"repository": "https://github.com/github/docs", "repository": "https://github.com/github/docs",
"standard": { "standard": {