Skip to content

Commit 7c188c2

Browse files
authored
feat!: require Node 22+ and ship as ESM (#424)
* update deps, apply prettier, change to ESM, update tests * update ci tests to use Node 22 * coderabbit 1 * remove exclude * update lockfiles * lint fixes * fix prettier config * fix npm ci * coderabbit 2 * downgrade and pin angular * update engine version range to match Angular * fix version and readme * update readme to suggest latest CLI
1 parent de351d6 commit 7c188c2

67 files changed

Lines changed: 20361 additions & 25303 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ const { overrides } = require('@netlify/eslint-config-node')
33
module.exports = {
44
extends: '@netlify/eslint-config-node',
55
rules: {
6-
'max-depth': 0,
76
complexity: 0,
87
'fp/no-let': 0,
98
'fp/no-loops': 0,
109
'fp/no-mutation': 0,
1110
'fp/no-mutating-methods': 0,
11+
'func-style': ['error', 'declaration'],
1212
'id-length': 0,
13+
'import/extensions': [
14+
'error',
15+
'ignorePackages',
16+
{
17+
js: 'always',
18+
},
19+
],
20+
'max-depth': 0,
1321
'max-statements': 0,
1422
'no-await-in-loop': 0,
1523
'node/exports-style': 0,
@@ -31,4 +39,8 @@ module.exports = {
3139
'unicorn/no-array-push-push': 0,
3240
},
3341
overrides: [...overrides],
42+
parserOptions: {
43+
ecmaVersion: 'latest',
44+
sourceType: 'module',
45+
},
3446
}

.github/workflows/failure-notifier.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
if: always()
1414
steps:
1515
- name: Checkout repository
16-
uses: actions/checkout@v5
16+
uses: actions/checkout@v6
1717
with:
1818
ref: ${{ github.event.pull_request.head.sha }}
1919

@@ -35,7 +35,7 @@ jobs:
3535
issues: write
3636
steps:
3737
- name: Check out the repository
38-
uses: actions/checkout@v5
38+
uses: actions/checkout@v6
3939
- name: Check conditions for failure notification
4040
id: check_label
4141
uses: actions/github-script@v8

.github/workflows/release-please.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
token: ${{ steps.get-token.outputs.token }}
2323
release-type: node
2424
package-name: '@netlify/angular-runtime'
25-
- uses: actions/checkout@v5
25+
- uses: actions/checkout@v6
2626
if: ${{ steps.release.outputs.release_created }}
2727
- uses: actions/setup-node@v6
2828
with:

.github/workflows/test.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,21 @@ on:
55
branches: [main]
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
build:
1013
runs-on: ${{ matrix.os }}
1114

1215
strategy:
1316
matrix:
1417
os: [ubuntu-latest, macOS-latest, windows-latest]
15-
node-version: [18.19.1, 20.19.1, 22]
16-
exclude:
17-
- os: macOS-latest
18-
node-version: 18.19.1
19-
- os: windows-latest
20-
node-version: 18.19.1
21-
- os: macOS-latest
22-
node-version: 20.19.1
23-
- os: windows-latest
24-
node-version: 20.19.1
18+
node-version: [22, 24]
2519
fail-fast: false
2620

2721
steps:
28-
- uses: actions/checkout@v5
22+
- uses: actions/checkout@v6
2923
- name: Use Node.js ${{ matrix.node-version }}
3024
uses: actions/setup-node@v6
3125
with:
@@ -35,10 +29,9 @@ jobs:
3529
name: NPM Install
3630
- name: Linting
3731
run: npm run format:ci
38-
if: "${{ matrix.node-version == '20.19.1' }}"
3932
- name: Install Deno
40-
uses: denoland/setup-deno@v1
33+
uses: denoland/setup-deno@v2
4134
with:
42-
deno-version: 2.5.6
35+
deno-version: 2.4.5
4336
- name: Run tests
4437
run: npm run test

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
commitlint --edit $1

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run format

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ node_modules
1919
test
2020
tests/fixtures
2121
tools/known-server-ts-signatures
22+
23+
package-lock.json

.prettierrc.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const prettierConfig = require('@netlify/eslint-config-node/.prettierrc.json')
2+
3+
module.exports = {
4+
...prettierConfig,
5+
endOfLine: 'auto',
6+
}

.prettierrc.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class FooComponent {
6666
console.log(`Rendering Foo for path ${request?.url} from location ${context?.geo?.city}`)
6767
// ...
6868
}
69-
69+
7070
}
7171
```
7272

@@ -98,15 +98,15 @@ export class FooComponent {
9898
console.log(`Rendering Foo for path ${request?.url} from location ${context?.geo?.city}`)
9999
// ...
100100
}
101-
101+
102102
}
103103
```
104104

105105
Note that App Engine in Angular 19 is in Developer Preview and requires explicit opt-in.
106106

107107
## Request handling
108108

109-
Starting with Angular@19. The build plugin makes use of the `server.ts` file to handle requests. The default Angular scaffolding generates incompatible code for Netlify so the build plugin will swap it for compatible `server.ts` file automatically if it detects default version being used.
109+
Starting with Angular@19. The build plugin makes use of the `server.ts` file to handle requests. The default Angular scaffolding generates incompatible code for Netlify so the build plugin will swap it for compatible `server.ts` file automatically if it detects default version being used.
110110

111111
Make sure you have `@netlify/angular-runtime` version 2.2.0 or later installed in your project. Netlify compatible `server.ts` file imports utilities from this package and Angular Compiler need to be able to resolve it and it can only do that if it's installed in your project and not when it's auto-installed by Netlify.
112112

@@ -118,7 +118,7 @@ If you are using Angular 20 or Angular 19 with App Engine Developer Preview:
118118

119119
```ts
120120
import { AngularAppEngine, createRequestHandler } from '@angular/ssr'
121-
import { getContext } from '@netlify/angular-runtime/context.mjs'
121+
import { getContext } from '@netlify/angular-runtime/context.js'
122122

123123
const angularAppEngine = new AngularAppEngine()
124124

@@ -146,7 +146,7 @@ If you are using Angular 19 and did not opt into the App Engine Developer Previe
146146

147147
```ts
148148
import { CommonEngine } from '@angular/ssr/node'
149-
import { render } from '@netlify/angular-runtime/common-engine.mjs'
149+
import { render } from '@netlify/angular-runtime/common-engine.js'
150150

151151
const commonEngine = new CommonEngine()
152152

@@ -181,7 +181,7 @@ The [`server.ts` file](https://angular.dev/guide/ssr#configure-server-side-rende
181181

182182
### Requirements
183183

184-
To use the Angular Runtime while building and deploying with the CLI, you need to have `netlify-cli v17.0.0` installed (or a later version).
184+
To use the Angular Runtime while building and deploying with the CLI, you need to have `netlify-cli v26.0.0` installed (or a later version).
185185

186186
Please also make sure to use `ntl deploy --build` (rather than `ntl build && ntl deploy`).
187187

0 commit comments

Comments
 (0)