Skip to content

Commit

Permalink
Upgrade to Node.js 14 (github#15822)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
zeke authored Oct 6, 2020
1 parent 6f5edb7 commit b22914d
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sync-algolia-search-indices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "12.x"
node-version: 14.x
- name: cache node modules
uses: actions/cache@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x

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

- name: Get npm cache directory
id: npm-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x

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

- name: Get npm cache directory
id: npm-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 12.x
node-version: 14.x

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

- name: Get npm cache directory
id: npm-cache
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.8.0
14.13.0
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# INSTALLATION IMAGE
# A temporary image that installs production-only dependencies

FROM node:12-alpine as installation
FROM node:14-alpine as installation
ENV NODE_ENV production
WORKDIR /usr/src/docs
COPY package*.json ./
Expand All @@ -18,7 +18,7 @@ RUN npm ci
# BUNDLE IMAGE
# 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
# Install the files used to create the bundles
COPY package*.json ./
Expand All @@ -32,7 +32,7 @@ RUN npm ci && npm run build
# --------------------------------------------------------------------------------
# MAIN IMAGE

FROM node:12-alpine
FROM node:14-alpine

# Let's make our home
WORKDIR /usr/src/docs
Expand Down
26 changes: 2 additions & 24 deletions 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 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:

Expand Down Expand Up @@ -52,26 +52,4 @@ For more info about working with this site, check out these READMEs:
- [middleware/README.md](../middleware/README.md)
- [script/README.md](../script/README.md)
- [stylesheets/README.md](../stylesheets/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
```
- [tests/README.md](../tests/README.md)
40 changes: 22 additions & 18 deletions contributing/node-versions.md
Original file line number Diff line number Diff line change
@@ -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:

- 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 `.github/*.workflow` Actions files
- The `Dockerfile` that can be used for deployments
- This README!
- [ ] 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 `.github/*.workflow` Actions files
- [ ] The `Dockerfile` that can be used for deployments
- [ ] 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
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.
[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:
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
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:
Expand All @@ -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 [...]
```

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:
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
```
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"pa11y-test": "start-server-and-test browser-test-server 4001 pa11y-ci"
},
"engines": {
"node": "8 - 12"
"node": "12 - 14"
},
"repository": "https://github.com/github/docs",
"standard": {
Expand Down

0 comments on commit b22914d

Please sign in to comment.