Skip to content

Commit 92a3f63

Browse files
authored
chore: bump to node 20 (#706)
* chore: bump to node 20 * try prettier * ayml
1 parent b3c8152 commit 92a3f63

File tree

12 files changed

+82
-50
lines changed

12 files changed

+82
-50
lines changed

Diff for: .github/workflows/ci.yml

+22-10
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ concurrency:
1515
jobs:
1616
test:
1717
name: Test
18-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-22.04
1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121

2222
- uses: actions/setup-node@v4
2323
with:
24-
node-version: "18"
24+
node-version-file: '.nvmrc'
25+
2526

2627
- run: |
2728
npm clean-install
@@ -30,19 +31,30 @@ jobs:
3031
3132
prettier-check:
3233
name: Prettier check
33-
runs-on: ubuntu-20.04
34+
runs-on: ubuntu-22.04
3435
steps:
35-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3637

37-
- uses: actionsx/prettier@v3
38+
- name: Setup node
39+
uses: actions/setup-node@v4
3840
with:
39-
args: --check "{src,test}/**/*.ts"
40-
41+
node-version-file: '.nvmrc'
42+
43+
# Installing all dependencies takes up to three minutes, hacking around to only installing prettier+deps
44+
- name: Download dependencies
45+
run: |
46+
rm package.json
47+
rm package-lock.json
48+
npm i prettier@3 [email protected]
49+
- name: Run prettier
50+
run: |-
51+
npx prettier -c '{src,test}/**/*.ts'
52+
4153
docker:
4254
name: Build with docker
43-
runs-on: ubuntu-20.04
55+
runs-on: ubuntu-22.04
4456
steps:
45-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
4658
name: Checkout Repo
4759

4860
- uses: docker/setup-buildx-action@v3

Diff for: .github/workflows/docs.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ concurrency:
1515
jobs:
1616
docs:
1717
name: Publish docs
18-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-22.04
1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121

2222
- uses: actions/setup-node@v4
2323
with:
24-
node-version: "18"
24+
node-version-file: '.nvmrc'
2525

2626
- run: |
2727
npm clean-install

Diff for: .github/workflows/publish-deps.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ on:
55

66
jobs:
77
publish:
8-
# Must match glibc verison in node:18
8+
# Must match glibc verison in node:20
99
runs-on: ubuntu-22.04
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
with:
1313
repository: 'pyramation/libpg-query-node'
14-
ref: 'v13'
14+
ref: 'v15'
1515

1616
- uses: actions/setup-node@v4
1717
with:
18-
node-version: '18'
18+
node-version-file: '.nvmrc'
1919

2020
- run: npm i
2121
- run: npm run binary:build

Diff for: .github/workflows/release.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ on:
99
jobs:
1010
semantic-release:
1111
name: Release
12-
runs-on: ubuntu-20.04
12+
runs-on: ubuntu-22.04
1313
outputs:
1414
new-release-published: ${{ steps.semantic-release.outputs.new_release_published }}
1515
new-release-version: ${{ steps.semantic-release.outputs.new_release_version }}
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- uses: actions/setup-node@v4
2020
with:
21-
node-version: '18'
21+
node-version-file: '.nvmrc'
2222

2323
- run: |
2424
npm clean-install
@@ -37,13 +37,13 @@ jobs:
3737
needs:
3838
- semantic-release
3939
if: needs.semantic-release.outputs.new-release-published == 'true'
40-
runs-on: ubuntu-20.04
40+
runs-on: ubuntu-22.04
4141
steps:
42-
- uses: actions/checkout@v3
42+
- uses: actions/checkout@v4
4343

4444
- uses: actions/setup-node@v4
4545
with:
46-
node-version: '18'
46+
node-version-file: '.nvmrc'
4747

4848
- name: Prepare release
4949
run: |

Diff for: .nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20

Diff for: Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18 as build
1+
FROM node:20 as build
22
WORKDIR /usr/src/app
33
# Do `npm ci` separately so we can cache `node_modules`
44
# https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
@@ -7,7 +7,7 @@ RUN npm clean-install
77
COPY . .
88
RUN npm run build && npm prune --omit=dev
99

10-
FROM node:18-slim
10+
FROM node:20-slim
1111
WORKDIR /usr/src/app
1212
COPY --from=build /usr/src/app/node_modules node_modules
1313
COPY --from=build /usr/src/app/dist dist
@@ -16,4 +16,4 @@ ENV PG_META_PORT=8080
1616
CMD ["npm", "run", "start"]
1717
EXPOSE 8080
1818
# --start-period defaults to 0s, but can't be set to 0s (to be explicit) by now
19-
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD node -e "require('http').get('http://localhost:8080/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"
19+
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD node -e "fetch('http://localhost:8080/health').then((r) => {if (r.status !== 200) throw new Error(r.status)})"

Diff for: package-lock.json

+29-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"test:update": "run-s db:clean db:run && vitest run && run-s db:clean"
3434
},
3535
"engines": {
36-
"node": ">=18",
37-
"npm": ">=8"
36+
"node": ">=20",
37+
"npm": ">=9"
3838
},
3939
"dependencies": {
4040
"@fastify/cors": "^9.0.1",
@@ -56,7 +56,7 @@
5656
},
5757
"devDependencies": {
5858
"@types/crypto-js": "^4.1.1",
59-
"@types/node": "^18.17.17",
59+
"@types/node": "^20.11.14",
6060
"@types/pg": "^8.6.5",
6161
"@types/pg-format": "^1.0.1",
6262
"cpy-cli": "^5.0.0",

Diff for: src/lib/secrets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Use dynamic import to support module mock
2-
const fs = await import('fs/promises')
2+
const fs = await import('node:fs/promises')
33

44
export const getSecret = async (key: string) => {
55
if (!key) {

Diff for: src/lib/sql/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { readFile } from 'fs/promises'
2-
import { dirname, join } from 'path'
3-
import { fileURLToPath } from 'url'
1+
import { readFile } from 'node:fs/promises'
2+
import { dirname, join } from 'node:path'
3+
import { fileURLToPath } from 'node:url'
44

55
const __dirname = dirname(fileURLToPath(import.meta.url))
66
export const columnPrivilegesSql = await readFile(join(__dirname, 'column_privileges.sql'), 'utf-8')

Diff for: test/lib/secrets.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { readFile } from 'fs/promises'
1+
import { readFile } from 'node:fs/promises'
22
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
33
import { getSecret } from '../../src/lib/secrets'
44

5-
vi.mock('fs/promises', async (): Promise<typeof import('fs/promises')> => {
6-
const originalModule = await vi.importActual<typeof import('fs/promises')>('fs/promises')
5+
vi.mock('node:fs/promises', async (): Promise<typeof import('node:fs/promises')> => {
6+
const originalModule =
7+
await vi.importActual<typeof import('node:fs/promises')>('node:fs/promises')
78
const readFile = vi.fn()
89
return {
910
...originalModule,

Diff for: test/server/ssl.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import CryptoJS from 'crypto-js'
2-
import fs from 'fs'
3-
import path from 'path'
4-
import { fileURLToPath } from 'url'
2+
import fs from 'node:fs'
3+
import path from 'node:path'
4+
import { fileURLToPath } from 'node:url'
55
import { expect, test } from 'vitest'
66
import { app } from './utils'
77
import { CRYPTO_KEY, DEFAULT_POOL_CONFIG } from '../../src/server/constants'

0 commit comments

Comments
 (0)