From b22914db598b45b228927f5f714b9b83724f4e2f Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 5 Oct 2020 17:02:55 -0700 Subject: [PATCH] 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 --- .../workflows/sync-algolia-search-indices.yml | 2 +- .github/workflows/test-translations.yml | 4 +- .github/workflows/test-windows.yml | 4 +- .github/workflows/test.yml | 4 +- .node-version | 2 +- Dockerfile | 6 +-- contributing/development.md | 26 +----------- contributing/node-versions.md | 40 ++++++++++--------- package.json | 2 +- 9 files changed, 36 insertions(+), 54 deletions(-) diff --git a/.github/workflows/sync-algolia-search-indices.yml b/.github/workflows/sync-algolia-search-indices.yml index 6a75fd5e3320..9af47377fc86 100644 --- a/.github/workflows/sync-algolia-search-indices.yml +++ b/.github/workflows/sync-algolia-search-indices.yml @@ -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: diff --git a/.github/workflows/test-translations.yml b/.github/workflows/test-translations.yml index 75d07d18bde8..68daec80992c 100644 --- a/.github/workflows/test-translations.yml +++ b/.github/workflows/test-translations.yml @@ -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 @@ -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 diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index c85ec1e04b61..649df7a1c31a 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -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 @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5bd73f20c56..ddfde7bbed7d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 diff --git a/.node-version b/.node-version index a54ec1fce4a4..98b0fc5f4475 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -12.8.0 \ No newline at end of file +14.13.0 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a99f471d8db9..59846b78f631 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 ./ @@ -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 ./ @@ -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 diff --git a/contributing/development.md b/contributing/development.md index 70dc76ca654f..000c3dfcec4f 100644 --- a/contributing/development.md +++ b/contributing/development.md @@ -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: @@ -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) \ No newline at end of file diff --git a/contributing/node-versions.md b/contributing/node-versions.md index 4c44e4dd4a3b..60c42b86f1f9 100644 --- a/contributing/node-versions.md +++ b/contributing/node-versions.md @@ -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: @@ -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 -``` \ No newline at end of file +``` diff --git a/package.json b/package.json index 57133d2f3fdb..0a873bd3e0a5 100644 --- a/package.json +++ b/package.json @@ -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": {