Skip to content

Commit

Permalink
chore: drop Node.js 12 and modernize the toolchain (#13705)
Browse files Browse the repository at this point in the history
- Stop testing on Node.js 12, start testing on Node.js 18
  (i.e., test on Node.js 14, 16, and 18).

*Before the changes:*

| Workflow                     | Node.js Version    |
| ---------------------------- | ------------------ |
| Buildkite (Tests):           | 14                 |
| Buildkite (Release):         | 12                 |
| GitHub Actions (Tests):      | 12, 16             |
| GitHub Actions (Other Jobs): | 12                 |

*After the changes:*

| Workflow                     | Node.js Version    |
| ---------------------------- | ------------------ |
| Buildkite (Tests):           | 14                 |
| Buildkite (Release):         | 14                 |
| GitHub Actions (Tests):      | 16, 18             |
| GitHub Actions (Other Jobs): | 16                 |

- Update the example commands in CONTRIBUTING.md:

  - Update the nvm installation command.

  - Update the Node.js installation command to install Node.js 16 since
    the text recommends using Active LTS and Node.js 14 is not Active
    LTS Anymore (it's already Maintenance LTS and on track to becoming
    EOL in 2023).

- Update the VSCode Dev Container to use the current Active LTS, update
  the comments there.

- Prepare to un-pin ts-node in a follow-up PR.
  Update ts-node in `packages/{client,debug}` from 28.0.3 to 28.0.4
  because `ts-node@28.0.3` has a peer dependency on `@types/jest@27`
  and new pnpm now errors on incorrect peer dependency instead of just
  printing a warning.
  • Loading branch information
aqrln committed Jun 9, 2022
1 parent 77c9419 commit da15e1f
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .buildkite/publish/docker-compose.yml
@@ -1,7 +1,7 @@
version: '3.7'
services:
app:
image: node:12-buster
image: node:14-buster
volumes:
- ../../:/app
working_dir: /app
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/Dockerfile
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/typescript-node/.devcontainer/base.Dockerfile

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

# [Optional] Uncomment this section to install additional OS packages.
Expand All @@ -13,4 +13,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"

# To install more global node packages
RUN su node -c "npm install -g pnpm ts-node"
RUN su node -c "npm install -g pnpm@6 ts-node"
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Expand Up @@ -4,9 +4,9 @@
"name": "Node.js & TypeScript",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 12, 14, 16
// Update 'VARIANT' to pick a Node version: 14, 16, 18
"args": {
"VARIANT": "14"
"VARIANT": "16"
}
},

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Expand Up @@ -91,7 +91,7 @@ jobs:
- uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: '12'
node-version: '16'

# https://github.com/actions/toolkit/blob/master/docs/commands.md#problem-matchers
# Matchers are added in setup-node
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
matrix:
queryEngine: ['library', 'binary']
os: [ubuntu-latest]
node: [12, 16]
node: [16, 18]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [12]
node: [16]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
fail-fast: false
matrix:
queryEngine: ['library', 'binary']
node: [12]
node: [16]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -304,7 +304,7 @@ jobs:
matrix:
queryEngine: ['library', 'binary']
os: [ubuntu-latest]
node: [12, 16]
node: [16, 18]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -366,7 +366,7 @@ jobs:
matrix:
queryEngine: ['library', 'binary']
os: [ubuntu-latest]
node: [12, 16]
node: [16, 18]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -437,7 +437,7 @@ jobs:
matrix:
queryEngine: ['library', 'binary']
os: [ubuntu-latest]
node: [12, 16]
node: [16, 18]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -492,7 +492,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [12, 16]
node: [16, 18]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -12,7 +12,7 @@ Welcome to the monorepo for our TypeScript code for the Prisma ORM. (for the Eng

## General Prerequisites

1. Install Node.js `>=12.6` minimum, [latest LTS is recommended](https://nodejs.org/en/about/releases/)
1. Install Node.js `>=14` minimum, [latest LTS is recommended](https://nodejs.org/en/about/releases/)

- Recommended: use [`nvm`](https://github.com/nvm-sh/nvm) for managing Node.js versions

Expand All @@ -26,8 +26,8 @@ https://github.com/direnv/direnv/blob/master/docs/installation.md
Copy paste these commands to install the global dependencies:

```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
nvm install 14
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm install 16
npm install --global pnpm@6 ts-node
# For direnv see https://github.com/direnv/direnv/blob/master/docs/installation.md
```
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -9,8 +9,8 @@
"Alexey Orlenko <orlenko@prisma.io>"
],
"engines": {
"node": ">=12.6",
"pnpm": ">=6.14.1"
"node": ">=14",
"pnpm": ">=6.14.1 <7"
},
"scripts": {
"setup": "ts-node scripts/setup.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Expand Up @@ -33,7 +33,7 @@
"bugs": "https://github.com/prisma/prisma/issues",
"license": "Apache-2.0",
"engines": {
"node": ">=12.6"
"node": ">=14"
},
"prisma": {
"prismaCommit": "placeholder-for-commit-hash-replaced-during-publishing-in-publish-ts"
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/scripts/preinstall.js
Expand Up @@ -41,11 +41,10 @@ const white = (str) => WHITE_BRIGHT + str + RESET
export function main() {
const nodeVersions = process.version.split('.')
const nodeMajorVersion = parseInt(nodeVersions[0].slice(1))
const nodeMinorVersion = parseInt(nodeVersions[1])
if (nodeMajorVersion < 12 || (nodeMajorVersion === 12 && nodeMinorVersion < 6)) {
if (nodeMajorVersion < 14) {
console.error(
drawBox({
str: `Prisma only supports Node.js >= 12.6`,
str: `Prisma only supports Node.js >= 14`,
verticalPadding: 1,
horizontalPadding: 3,
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/commands/Studio.test.ts
Expand Up @@ -7,7 +7,7 @@ import { Studio } from '../../Studio'

const STUDIO_TEST_PORT = 5678

async function sendRequest(message: any): Promise<any> {
function sendRequest(message: any): Promise<any> {
return fetch(`http://localhost:${STUDIO_TEST_PORT}/api`, {
method: 'POST',
headers: {
Expand Down
4 changes: 2 additions & 2 deletions packages/client/package.json
Expand Up @@ -24,7 +24,7 @@
"types": "index.d.ts",
"license": "Apache-2.0",
"engines": {
"node": ">=12.6"
"node": ">=14"
},
"homepage": "https://www.prisma.io",
"repository": {
Expand Down Expand Up @@ -120,7 +120,7 @@
"stacktrace-parser": "0.1.10",
"strip-ansi": "6.0.1",
"strip-indent": "3.0.0",
"ts-jest": "28.0.3",
"ts-jest": "28.0.4",
"ts-node": "10.8.0",
"tsd": "0.20.0",
"typescript": "4.7.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/debug/package.json
Expand Up @@ -23,7 +23,7 @@
"esbuild": "0.14.39",
"jest": "28.1.0",
"jest-junit": "13.2.0",
"ts-jest": "28.0.3",
"ts-jest": "28.0.4",
"typescript": "4.7.2"
},
"scripts": {
Expand Down

0 comments on commit da15e1f

Please sign in to comment.