Skip to content

Commit 0f43831

Browse files
robertsLandoclaude
andauthored
chore: update dependencies, drop Node.js 18, add Node.js 22/24 support, and fix test compatibility (#214)
* fix: resolve security vulnerabilities in dependencies - Upgrade esbuild from ^0.24.0 to ^0.25.0 to fix moderate severity CORS vulnerability - Upgrade tar from ^7.5.6 to ^7.5.7 to fix high severity path traversal vulnerability - Add yarn resolutions to fix transitive dependency vulnerabilities: - lodash ^4.17.23 (prototype pollution) - @octokit/request-error ^5.1.1 (ReDoS) - @octokit/plugin-paginate-rest ^9.2.2 (ReDoS) - @octokit/request ^8.4.1 (ReDoS) - js-yaml ^4.1.1 (prototype pollution) - brace-expansion ^2.0.2 (ReDoS) - tmp ^0.2.4 (symlink vulnerability) All tests and linting pass with no breaking changes. Fixes 16 security vulnerabilities (4 Low, 11 Moderate, 1 High). * fix: remove TypeScript error suppression comments related to babel/types version mismatches * chore: update dependencies and reduce resolutions to fix security vulnerabilities - Update production dependencies (esbuild, into-stream) - Update dev dependencies (release-it, @release-it/conventional-changelog, @types/node, rimraf, eslint-config-airbnb-typescript, lint-staged) - Reduce resolutions from 7 to 2 (keep only lodash and undici for release-it compatibility) - Add types:[] to tsconfig.json to prevent stub @types package inclusion - Fix code formatting in test file All security vulnerabilities resolved (0 vulnerabilities in yarn audit) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore: upgrade to release-it@19 and remove all resolutions - Upgrade release-it from 18.0.0 to 19.2.4 - Remove all remaining resolutions (lodash, undici) - Now using Node.js 22.22.0 which allows release-it@19.x - Zero security vulnerabilities confirmed via yarn audit Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * chore: drop support for Node.js 18 and add support for Node.js 22 across CI, tests, and documentation * fix: resolve glob pattern in rimraf causing EINVAL on Windows rimraf v4+ no longer accepts glob wildcards in paths. Use tinyglobby to expand the pattern before passing resolved paths to rimraf. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: add Node.js 24 to CI matrix and test targets Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1715693 commit 0f43831

15 files changed

Lines changed: 960 additions & 1299 deletions

File tree

.github/ISSUE_TEMPLATE/01_bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ body:
3838
- type: input
3939
attributes:
4040
label: What Node versions, OSs and CPU architectures are you building for?
41-
description: 'For example: default, node18, node18-linux-x64, node16-win-arm64'
41+
description: 'For example: default, node20, node20-linux-x64, node22-win-arm64'
4242
validations:
4343
required: true
4444
- type: textarea

.github/ISSUE_TEMPLATE/02_regression.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ body:
4444
- type: input
4545
attributes:
4646
label: What Node versions, OSs and CPU architectures are you building for?
47-
description: 'For example: default, node18, node18-linux-x64, node16-win-arm64'
47+
description: 'For example: default, node20, node20-linux-x64, node22-win-arm64'
4848
validations:
4949
required: true
5050
- type: textarea

.github/copilot-instructions.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This is a TypeScript-based Node.js project that packages Node.js applications in
1616
`pkg` is a command-line tool that:
1717

1818
- Packages Node.js projects into executables for multiple platforms (Linux, macOS, Windows)
19-
- Supports multiple Node.js versions (node18, node20, etc.)
19+
- Supports multiple Node.js versions (node20, node22, etc.)
2020
- Uses virtual filesystem to bundle application files
2121
- Compiles JavaScript to V8 bytecode for distribution
2222
- Supports native addons (.node files)
@@ -111,8 +111,8 @@ npm run build
111111
npm test
112112

113113
# Run tests for specific Node.js version
114-
npm run test:18 # Test with Node.js 18
115114
npm run test:20 # Test with Node.js 20
115+
npm run test:22 # Test with Node.js 22
116116
npm run test:host # Test with host Node.js version
117117

118118
# Run specific test pattern
@@ -268,8 +268,8 @@ The project uses GitHub Actions workflows:
268268

269269
- **ci.yml**: Runs linting and builds on multiple Node.js versions and OS platforms
270270
- **test.yml**: Reusable workflow for running tests
271-
- Matrix strategy tests: Node.js 18.x, 20.x on ubuntu-latest, windows-latest, macos-latest
272-
- Linting only runs on ubuntu-latest with Node.js 18.x
271+
- Matrix strategy tests: Node.js 20.x, 22.x on ubuntu-latest, windows-latest, macos-latest
272+
- Linting only runs on ubuntu-latest with Node.js 20.x
273273

274274
## Support and Resources
275275

@@ -287,7 +287,7 @@ The project uses GitHub Actions workflows:
287287
2. **ALWAYS check lint before committing**: Run `npm run lint` before every commit and fix all issues - NEVER commit with lint errors
288288
3. **Clean test artifacts before staging**: Remove any test-generated executables (`*.exe`, `*-linux`, `*-macos`, `*-win.exe`) from test directories before committing
289289
4. **Always build before testing**: Run `npm run build` before running any tests
290-
5. **Use correct Node.js version**: The project requires Node.js >= 18.0.0
290+
5. **Use correct Node.js version**: The project requires Node.js >= 20.0.0
291291
6. **Use Yarn for package management**: This project uses `yarn`, not `npm`, for dependency management
292292
7. **Respect TypeScript compilation**: Edit `lib/*.ts` files, not `lib-es5/*.js` files
293293
8. **Maintain test numbering**: When adding tests, choose appropriate test number (XX in test-XX-name)

.github/workflows/ci.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false # prevent test to stop if one fails
1313
matrix:
14-
node-version: [18.x, 20.x]
14+
node-version: [20.x, 22.x, 24.x]
1515
os: [ubuntu-latest, windows-latest, macos-latest]
1616
runs-on: ${{ matrix.os }}
1717
steps:
@@ -23,20 +23,25 @@ jobs:
2323

2424
- run: yarn install
2525

26-
- if: matrix['node-version'] == '18.x' && matrix['os'] == 'ubuntu-latest'
26+
- if: matrix['node-version'] == '20.x' && matrix['os'] == 'ubuntu-latest'
2727
run: yarn lint
2828
- run: yarn build
2929
test_host:
3030
uses: ./.github/workflows/test.yml
3131
with:
3232
npm_command: test:host
33-
34-
test_18:
33+
34+
test_22:
3535
uses: ./.github/workflows/test.yml
3636
with:
37-
npm_command: test:18
37+
npm_command: test:22
3838

3939
test_20:
4040
uses: ./.github/workflows/test.yml
4141
with:
4242
npm_command: test:20
43+
44+
test_24:
45+
uses: ./.github/workflows/test.yml
46+
with:
47+
npm_command: test:24

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false # prevent test to stop if one fails
1515
matrix:
16-
node-version: [18.x, 20.x]
16+
node-version: [20.x, 22.x, 24.x]
1717
os: [ubuntu-latest, windows-latest, macos-latest]
1818
runs-on: ${{ matrix.os }}
1919
steps:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ After installing it, run `pkg --help` without arguments to see list of options:
5353
– Makes executable for particular target machine
5454
$ pkg -t node14-win-arm64 index.js
5555
– Makes executables for target machines of your choice
56-
$ pkg -t node16-linux,node18-linux,node18-win index.js
56+
$ pkg -t node20-linux,node22-linux,node22-win index.js
5757
– Bakes '--expose-gc' and '--max-heap-size=34' into executable
5858
$ pkg --options "expose-gc,max-heap-size=34" index.js
5959
– Consider packageA and packageB to be public
@@ -82,7 +82,7 @@ The entrypoint of your project is a mandatory CLI argument. It may be:
8282
`pkg` can generate executables for several target machines at a
8383
time. You can specify a comma-separated list of targets via `--targets`
8484
option. A canonical target consists of 3 elements, separated by
85-
dashes, for example `node18-macos-x64` or `node14-linux-arm64`:
85+
dashes, for example `node20-macos-x64` or `node22-linux-arm64`:
8686

8787
- **nodeRange** (node8), node10, node12, node14, node16 or latest
8888
- **platform** alpine, linux, linuxstatic, win, macos, (freebsd)

lib/esm-transformer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ export function transformESMtoCJS(
376376
const esbuildOptions: esbuild.TransformOptions = {
377377
loader: 'js',
378378
format: 'cjs',
379-
target: 'node18',
379+
target: 'node20',
380380
sourcemap: false,
381381
minify: false,
382382
keepNames: true,

lib/help.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function help() {
3232
${pc.gray('–')} Makes executable for particular target machine
3333
${pc.cyan('$ pkg -t node14-win-arm64 index.js')}
3434
${pc.gray('–')} Makes executables for target machines of your choice
35-
${pc.cyan('$ pkg -t node16-linux,node18-linux,node18-win index.js')}
35+
${pc.cyan('$ pkg -t node22-linux,node24-linux,node24-win index.js')}
3636
${pc.gray('–')} Bakes '--expose-gc' and '--max-heap-size=34' into executable
3737
${pc.cyan('$ pkg --options "expose-gc,max-heap-size=34" index.js')}
3838
${pc.gray('–')} Consider packageA and packageB to be public

package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"@babel/traverse": "^7.23.0",
2828
"@babel/types": "^7.23.0",
2929
"@yao-pkg/pkg-fetch": "3.5.32",
30-
"esbuild": "^0.25.0",
31-
"into-stream": "^6.0.0",
30+
"esbuild": "^0.27.3",
31+
"into-stream": "^9.1.0",
3232
"minimist": "^1.2.6",
3333
"multistream": "^4.1.0",
3434
"picocolors": "^1.1.0",
@@ -42,12 +42,12 @@
4242
"unzipper": "^0.12.3"
4343
},
4444
"devDependencies": {
45-
"@release-it/conventional-changelog": "^7.0.2",
45+
"@release-it/conventional-changelog": "^10.0.5",
4646
"@types/babel__generator": "^7.6.5",
4747
"@types/babel__traverse": "^7.20.3",
4848
"@types/minimist": "^1.2.2",
4949
"@types/multistream": "^4.1.0",
50-
"@types/node": "^16.18.113",
50+
"@types/node": "^20.0.0",
5151
"@types/picomatch": "^3.0.1",
5252
"@types/resolve": "^1.20.2",
5353
"@types/stream-meter": "^0.0.22",
@@ -58,15 +58,15 @@
5858
"esbuild-register": "^3.6.0",
5959
"eslint": "^9.0.0",
6060
"eslint-config-airbnb-base": "^15.0.0",
61-
"eslint-config-airbnb-typescript": "^17.1.0",
61+
"eslint-config-airbnb-typescript": "^18.0.0",
6262
"eslint-config-prettier": "^10.0.0",
6363
"eslint-plugin-import": "^2.31.0",
6464
"globals": "^17.3.0",
6565
"json-stable-stringify": "^1.0.1",
66-
"lint-staged": "^15.2.10",
66+
"lint-staged": "^15.0.0",
6767
"prettier": "^3.0.3",
68-
"release-it": "^17.0.0",
69-
"rimraf": "^3.0.2",
68+
"release-it": "^19.2.4",
69+
"rimraf": "^6.1.2",
7070
"simple-git-hooks": "^2.11.1",
7171
"typescript": "^4.7.2"
7272
},
@@ -80,9 +80,10 @@
8080
"fix": "npm run lint:style -- -w && npm run lint:code -- --fix",
8181
"prepare": "npm run build",
8282
"prepublishOnly": "npm run lint",
83-
"test": "npm run build && npm run test:host && npm run test:18 && npm run test:20",
83+
"test": "npm run build && npm run test:host && npm run test:20 && npm run test:22 && npm run test:24",
8484
"test:20": "node test/test.js node20 no-npm",
85-
"test:18": "node test/test.js node18 no-npm",
85+
"test:22": "node test/test.js node22 no-npm",
86+
"test:24": "node test/test.js node24 no-npm",
8687
"test:host": "node test/test.js host only-npm",
8788
"bump:fetch": "yarn add @yao-pkg/pkg-fetch --exact",
8889
"release": "read -p 'GITHUB_TOKEN: ' GITHUB_TOKEN && export GITHUB_TOKEN=$GITHUB_TOKEN && release-it"
@@ -98,7 +99,7 @@
9899
},
99100
"packageManager": "yarn@1.22.22",
100101
"engines": {
101-
"node": ">=18.0.0"
102+
"node": ">=20.0.0"
102103
},
103104
"resolutions": {
104105
"lodash": "^4.17.23",

plans/drop-node18-add-node22.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Plan: Drop node18 target, add node22 target
2+
3+
## Context
4+
5+
The project currently supports `node18` and `node20` as compilation targets (plus `host`). The user wants to drop `node18` and add `node22` instead, updating CI, source code, tests, and documentation accordingly.
6+
7+
## Changes
8+
9+
### 1. CI Workflows
10+
11+
**`.github/workflows/ci.yml`**
12+
13+
- Change build matrix from `[18.x, 20.x]` to `[20.x, 22.x]`
14+
- Change lint condition from `node-version == '18.x'` to `node-version == '20.x'`
15+
- Replace `test_18` job with `test_22` (calling `test:22`)
16+
- Keep `test_20` and `test_host`
17+
18+
**`.github/workflows/test.yml`**
19+
20+
- Change test matrix from `[18.x, 20.x]` to `[20.x, 22.x]`
21+
22+
### 2. Package configuration
23+
24+
**`package.json`**
25+
26+
- Update `engines.node` from `>=18.0.0` to `>=20.0.0`
27+
- Replace `test:18` script with `test:22`: `"node test/test.js node22 no-npm"`
28+
- Update `test` script to call `test:22` instead of `test:18`
29+
30+
### 3. ESM Transformer
31+
32+
**`lib/esm-transformer.ts`** (line 379)
33+
34+
- Change esbuild target from `'node18'` to `'node20'` (new minimum supported version)
35+
36+
### 4. Tests
37+
38+
**`test/test-42-fetch-all/main.js`** (line 18)
39+
40+
- Change `nodeRanges` from `['node18', 'node20', 'node22']` to `['node20', 'node22']`
41+
42+
**`test/test-50-fs-runtime-layer-3/main.js`** (lines 29-32)
43+
44+
- The `node18`-specific branch is no longer needed. Since we only target node20+, the error message is always the ENOENT variant. Remove the `node18` conditional and use the `node20+` behavior unconditionally.
45+
46+
### 5. Documentation & templates
47+
48+
**`lib/help.ts`** (line 35)
49+
50+
- Update example from `node16-linux,node18-linux,node18-win` to `node20-linux,node22-linux,node22-win`
51+
52+
**`README.md`** (lines 56, 85)
53+
54+
- Update example from `node16-linux,node18-linux,node18-win` to `node20-linux,node22-linux,node22-win`
55+
- Update target example from `node18-macos-x64` to `node20-macos-x64`
56+
57+
**`.github/copilot-instructions.md`**
58+
59+
- Update node version references (node18 -> node20, matrix mention, lint reference, engines note)
60+
61+
**`.github/ISSUE_TEMPLATE/01_bug_report.yml`** and **`02_regression.yml`**
62+
63+
- Update example targets from `node18` to `node20`
64+
65+
## Verification
66+
67+
1. `yarn build` — ensure TypeScript compiles cleanly
68+
2. `yarn lint` — ensure no lint errors
69+
3. `yarn test:host` — run host-target tests
70+
4. `yarn test:20` — run node20 target tests
71+
5. `yarn test:22` — run new node22 target tests

0 commit comments

Comments
 (0)