Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update node action engine to Node20 #564

Merged
merged 5 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
Expand All @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: npm
- name: install dependencies
run: npm ci --ignore-scripts
Expand Down
9 changes: 0 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,3 @@ esbuild app.jsx --bundle --platform=node --packages=external

If you do this, your dependencies must still be present on the file system at run-time since they are no longer included in the bundle.
```

## Why using nodejs16 instead of deno/bun/nodejs18?

They are not yet supported in JavaScript action engine.

- https://github.com/actions/runner/blob/5421fe3f7107f770c904ed4c7e506ae7a5cde2c2/src/Runner.Worker/ActionManifestManager.cs#L492
- https://github.com/kachick/wait-other-jobs/pull/273#issuecomment-1306058624

After bumped to nodejs18, I'd like to replace jest with [built-in test runner](https://github.com/nodejs/node/pull/42325).
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ inputs:
required: false
default: 'false'
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
13 changes: 2 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@
outputs = { self, nixpkgs-unstable, nixpkgs-stable, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
# https://discourse.nixos.org/t/mark-a-devshell-dependency-as-insecure/24354/3
unstable-pkgs = import nixpkgs-unstable
{
inherit system;
config = {
permittedInsecurePackages = [
"nodejs-16.20.2"
];
};
};
unstable-pkgs = nixpkgs-unstable.legacyPackages.${system};
stable-pkgs = nixpkgs-stable.legacyPackages.${system};
in
{
Expand All @@ -32,7 +23,7 @@
# https://github.com/NixOS/nix/issues/730#issuecomment-162323824
bashInteractive

nodejs-16_x
nodejs_20
deno
dprint
cargo-make
Expand Down
2 changes: 1 addition & 1 deletion jest.post.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const config: Config.InitialOptions = {
'^.+\\.(t|j)sx?$': [
'esbuild-jest-transform',
{
'target': 'node16',
'target': 'node20',
'packages': 'external',
},
],
Expand Down
2 changes: 1 addition & 1 deletion jest.pre.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const config: Config = {
'^.+\\.(t|j)sx?$': [
'esbuild-jest-transform',
{
'target': 'node16',
'target': 'node20',
'packages': 'external',
},
],
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"description": "",
"main": "lib/main.js",
"engines": {
"node": "16.x"
"node": "20.x"
},
"scripts": {
"prepackage": "tsx scripts/rmrf.ts lib dist",
"package": "esbuild src/main.ts --bundle --platform=node --target=node16 --packages=external --outfile=lib/main.js && ncc build",
"package": "esbuild src/main.ts --bundle --platform=node --target=node20 --packages=external --outfile=lib/main.js && ncc build",
"postpackage": "tsx scripts/rmrf.ts lib",
"test:ts": "jest --config jest.pre.config.ts",
"pretest:js": "npm run package",
Expand Down
12 changes: 7 additions & 5 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
// Import from https://github.com/tsconfig/bases/commit/0ae4791797d8ba3dd2bca9aca880eb2d3e30e6fb
// To avoid issues around tsconfig.extends array
// Import from tsconfig/bases
// - https://github.com/tsconfig/bases/blob/5ee68ffc8325546335649525a3553067d2d27830/bases/node20.json
// - https://github.com/tsconfig/bases/blob/5ee68ffc8325546335649525a3553067d2d27830/bases/strictest.json
// Inlined to avoid problems around tsconfig.extends array
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Node 16 + Strictest",
"display": "Node 20 + Strictest",
"compilerOptions": {
"lib": [
"es2021"
"es2023"
],
"module": "node16",
"target": "es2021",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
Expand Down
2 changes: 0 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// TODO: Use tsconfig/base after all tools support tsconfig.extends array
"extends": "./tsconfig.base.json",
"compilerOptions": {
// https://www.typescriptlang.org/docs/handbook/esm-node.html
"module": "node16",
"noEmit": true,
"noUnusedLocals": false
},
Expand Down