Skip to content

Commit 37f02f7

Browse files
authored
feat(angular): support angular 18.0.0 (#22509)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #25284
1 parent 881adfb commit 37f02f7

File tree

96 files changed

+3718
-1196
lines changed

Some content is hidden

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

96 files changed

+3718
-1196
lines changed

docs/generated/manifests/nx-api.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"type": "executor"
6464
},
6565
"/nx-api/angular/executors/ng-packagr-lite": {
66-
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but with some key differences:\n- For supported Angular versions lower than v16, it doesn't run `ngcc` automatically (`ngcc` is no longer available from Angular v16 onwards, for lower versions, it needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`).\n- It only produces ESM2022 bundles (ESM2020 for supported Angular versions lower than v16).",
66+
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles.",
6767
"file": "generated/packages/angular/executors/ng-packagr-lite.json",
6868
"hidden": false,
6969
"name": "ng-packagr-lite",

docs/generated/packages-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"type": "executor"
5959
},
6060
{
61-
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but with some key differences:\n- For supported Angular versions lower than v16, it doesn't run `ngcc` automatically (`ngcc` is no longer available from Angular v16 onwards, for lower versions, it needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`).\n- It only produces ESM2022 bundles (ESM2020 for supported Angular versions lower than v16).",
61+
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles.",
6262
"file": "generated/packages/angular/executors/ng-packagr-lite.json",
6363
"hidden": false,
6464
"name": "ng-packagr-lite",

docs/generated/packages/angular/executors/application.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
},
3939
"output": {
4040
"type": "string",
41+
"default": "",
4142
"description": "Absolute path within the output."
4243
}
4344
},
4445
"additionalProperties": false,
45-
"required": ["glob", "input", "output"]
46+
"required": ["glob", "input"]
4647
},
4748
{ "type": "string" }
4849
]
@@ -663,11 +664,12 @@
663664
},
664665
"output": {
665666
"type": "string",
667+
"default": "",
666668
"description": "Absolute path within the output."
667669
}
668670
},
669671
"additionalProperties": false,
670-
"required": ["glob", "input", "output"]
672+
"required": ["glob", "input"]
671673
},
672674
{ "type": "string" }
673675
]

docs/generated/packages/angular/executors/browser-esbuild.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
},
3939
"output": {
4040
"type": "string",
41+
"default": "",
4142
"description": "Absolute path within the output."
4243
}
4344
},
4445
"additionalProperties": false,
45-
"required": ["glob", "input", "output"]
46+
"required": ["glob", "input"]
4647
},
4748
{ "type": "string" }
4849
]
@@ -572,11 +573,12 @@
572573
},
573574
"output": {
574575
"type": "string",
576+
"default": "",
575577
"description": "Absolute path within the output."
576578
}
577579
},
578580
"additionalProperties": false,
579-
"required": ["glob", "input", "output"]
581+
"required": ["glob", "input"]
580582
},
581583
{ "type": "string" }
582584
]

docs/generated/packages/angular/executors/ng-packagr-lite.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outputCapture": "direct-nodejs",
77
"$schema": "https://json-schema.org/schema",
88
"title": "ng-packagr Target",
9-
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but with some key differences:\n- For supported Angular versions lower than v16, it doesn't run `ngcc` automatically (`ngcc` is no longer available from Angular v16 onwards, for lower versions, it needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`).\n- It only produces ESM2022 bundles (ESM2020 for supported Angular versions lower than v16).",
9+
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles.",
1010
"cli": "nx",
1111
"type": "object",
1212
"presets": [
@@ -44,7 +44,7 @@
4444
"additionalProperties": false,
4545
"required": ["project"]
4646
},
47-
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but with some key differences:\n- For supported Angular versions lower than v16, it doesn't run `ngcc` automatically (`ngcc` is no longer available from Angular v16 onwards, for lower versions, it needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`).\n- It only produces ESM2022 bundles (ESM2020 for supported Angular versions lower than v16).",
47+
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles.",
4848
"aliases": [],
4949
"hidden": false,
5050
"path": "/packages/angular/src/executors/ng-packagr-lite/schema.json",

docs/generated/packages/angular/executors/webpack-browser.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@
5656
},
5757
"output": {
5858
"type": "string",
59+
"default": "",
5960
"description": "Absolute path within the output."
6061
}
6162
},
6263
"additionalProperties": false,
63-
"required": ["glob", "input", "output"]
64+
"required": ["glob", "input"]
6465
},
6566
{ "type": "string" }
6667
]
@@ -592,11 +593,12 @@
592593
},
593594
"output": {
594595
"type": "string",
596+
"default": "",
595597
"description": "Absolute path within the output."
596598
}
597599
},
598600
"additionalProperties": false,
599-
"required": ["glob", "input", "output"]
601+
"required": ["glob", "input"]
600602
},
601603
{ "type": "string" }
602604
]

docs/generated/packages/angular/executors/webpack-server.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"properties": {
1212
"assets": {
1313
"type": "array",
14-
"description": "List of static application assets. _Note: only supported in Angular versions >= 15.1.0_",
14+
"description": "List of static application assets.",
1515
"default": [],
1616
"items": {
1717
"oneOf": [
@@ -38,11 +38,12 @@
3838
},
3939
"output": {
4040
"type": "string",
41+
"default": "",
4142
"description": "Absolute path within the output."
4243
}
4344
},
4445
"additionalProperties": false,
45-
"required": ["glob", "input", "output"]
46+
"required": ["glob", "input"]
4647
},
4748
{ "type": "string" }
4849
]
@@ -186,7 +187,7 @@
186187
},
187188
"vendorChunk": {
188189
"type": "boolean",
189-
"description": "Generate a separate bundle containing only vendor libraries. This option should only be used for development to reduce the incremental compilation time. _Note: supported in Angular versions >= 15.1.0_",
190+
"description": "Generate a separate bundle containing only vendor libraries. This option should only be used for development to reduce the incremental compilation time.",
190191
"default": false
191192
},
192193
"verbose": {
@@ -248,7 +249,7 @@
248249
},
249250
"buildOptimizer": {
250251
"type": "boolean",
251-
"description": "Enables advanced build optimizations. _Note: only supported in Angular versions >= 16.0.0_.",
252+
"description": "Enables advanced build optimizations.",
252253
"default": true
253254
},
254255
"namedChunks": {
@@ -323,11 +324,12 @@
323324
},
324325
"output": {
325326
"type": "string",
327+
"default": "",
326328
"description": "Absolute path within the output."
327329
}
328330
},
329331
"additionalProperties": false,
330-
"required": ["glob", "input", "output"]
332+
"required": ["glob", "input"]
331333
},
332334
{ "type": "string" }
333335
]

docs/generated/packages/angular/generators/setup-ssr.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
"appId": {
2020
"type": "string",
2121
"format": "html-selector",
22-
"description": "The `appId` to use with `withServerTransition`. _Note: This is only used in Angular versions <16.0.0. It's deprecated since Angular 16 and not supported since Angular 17._",
23-
"default": "serverApp"
22+
"description": "The `appId` to use with `withServerTransition`.",
23+
"default": "serverApp",
24+
"x-deprecated": "This is deprecated and ignored since Angular 16 and not supported since Angular 17."
2425
},
2526
"main": {
2627
"type": "string",
@@ -55,7 +56,7 @@
5556
},
5657
"hydration": {
5758
"type": "boolean",
58-
"description": "Set up Hydration for the SSR application. It defaults to `true` for Angular versions >= 17.0.0. Otherwise, it defaults to `false`. _Note: This is only supported in Angular versions >= 16.0.0_."
59+
"description": "Set up Hydration for the SSR application. It defaults to `true` for Angular versions >= 17.0.0. Otherwise, it defaults to `false`."
5960
},
6061
"skipFormat": {
6162
"type": "boolean",

e2e/angular/src/misc.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Move Angular Project', () => {
4242
expect(moveOutput).toContain(`CREATE ${newPath}/tsconfig.json`);
4343
expect(moveOutput).toContain(`CREATE ${newPath}/tsconfig.spec.json`);
4444
expect(moveOutput).toContain(`CREATE ${newPath}/.eslintrc.json`);
45-
expect(moveOutput).toContain(`CREATE ${newPath}/src/favicon.ico`);
45+
expect(moveOutput).toContain(`CREATE ${newPath}/public/favicon.ico`);
4646
expect(moveOutput).toContain(`CREATE ${newPath}/src/index.html`);
4747
expect(moveOutput).toContain(`CREATE ${newPath}/src/main.ts`);
4848
expect(moveOutput).toContain(`CREATE ${newPath}/src/styles.css`);
@@ -52,7 +52,6 @@ describe('Move Angular Project', () => {
5252
);
5353
expect(moveOutput).toContain(`CREATE ${newPath}/src/app/app.component.ts`);
5454
expect(moveOutput).toContain(`CREATE ${newPath}/src/app/app.config.ts`);
55-
expect(moveOutput).toContain(`CREATE ${newPath}/src/assets/.gitkeep`);
5655
});
5756

5857
/**

e2e/angular/src/ng-add.test.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
185185
browser: `apps/${project}/src/main.ts`,
186186
polyfills: [`zone.js`],
187187
tsConfig: `apps/${project}/tsconfig.app.json`,
188-
assets: [
189-
`apps/${project}/src/favicon.ico`,
190-
`apps/${project}/src/assets`,
191-
],
188+
assets: [{ glob: '**/*', input: `apps/${project}/public` }],
192189
styles: [`apps/${project}/src/styles.css`],
193190
scripts: [`apps/${project}/src/scripts.js`],
194191
},
@@ -197,13 +194,13 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
197194
budgets: [
198195
{
199196
type: 'initial',
200-
maximumWarning: '500kb',
201-
maximumError: '1mb',
197+
maximumWarning: '500kB',
198+
maximumError: '1MB',
202199
},
203200
{
204201
type: 'anyComponentStyle',
205-
maximumWarning: '2kb',
206-
maximumError: '4kb',
202+
maximumWarning: '2kB',
203+
maximumError: '4kB',
207204
},
208205
],
209206
outputHashing: 'all',
@@ -229,10 +226,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
229226
options: {
230227
polyfills: [`zone.js`, `zone.js/testing`],
231228
tsConfig: `apps/${project}/tsconfig.spec.json`,
232-
assets: [
233-
`apps/${project}/src/favicon.ico`,
234-
`apps/${project}/src/assets`,
235-
],
229+
assets: [{ glob: '**/*', input: `apps/${project}/public` }],
236230
styles: [`apps/${project}/src/styles.css`],
237231
scripts: [`apps/${project}/src/scripts.js`],
238232
},

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@
2525
},
2626
"devDependencies": {
2727
"@actions/core": "^1.10.0",
28-
"@angular-devkit/architect": "~0.1703.0",
29-
"@angular-devkit/build-angular": "~17.3.0",
30-
"@angular-devkit/core": "~17.3.0",
31-
"@angular-devkit/schematics": "~17.3.0",
32-
"@angular-eslint/eslint-plugin": "17.3.0",
33-
"@angular-eslint/eslint-plugin-template": "17.3.0",
34-
"@angular-eslint/template-parser": "17.3.0",
35-
"@angular/cli": "~17.3.0",
36-
"@angular/common": "~17.3.0",
37-
"@angular/compiler": "~17.3.0",
38-
"@angular/compiler-cli": "~17.3.0",
39-
"@angular/core": "~17.3.0",
40-
"@angular/router": "~17.3.0",
28+
"@angular-devkit/architect": "~0.1800.0",
29+
"@angular-devkit/build-angular": "~18.0.0",
30+
"@angular-devkit/core": "~18.0.0",
31+
"@angular-devkit/schematics": "~18.0.0",
32+
"@angular-eslint/eslint-plugin": "~17.3.0",
33+
"@angular-eslint/eslint-plugin-template": "~17.3.0",
34+
"@angular-eslint/template-parser": "~17.3.0",
35+
"@angular/cli": "~18.0.0",
36+
"@angular/common": "~18.0.0",
37+
"@angular/compiler": "~18.0.0",
38+
"@angular/compiler-cli": "~18.0.0",
39+
"@angular/core": "~18.0.0",
40+
"@angular/router": "~18.0.0",
4141
"@babel/core": "^7.23.2",
4242
"@babel/helper-create-regexp-features-plugin": "^7.22.9",
4343
"@babel/plugin-transform-runtime": "^7.23.2",
@@ -92,7 +92,7 @@
9292
"@rollup/plugin-json": "^6.1.0",
9393
"@rollup/plugin-node-resolve": "^15.2.3",
9494
"@rollup/plugin-url": "^8.0.2",
95-
"@schematics/angular": "~17.3.0",
95+
"@schematics/angular": "~18.0.0",
9696
"@storybook/addon-essentials": "7.5.3",
9797
"@storybook/core-server": "7.5.3",
9898
"@storybook/react": "7.5.3",
@@ -226,7 +226,7 @@
226226
"mini-css-extract-plugin": "~2.4.7",
227227
"minimatch": "9.0.3",
228228
"next-sitemap": "^3.1.10",
229-
"ng-packagr": "~17.3.0",
229+
"ng-packagr": "~18.0.0",
230230
"node-fetch": "^2.6.7",
231231
"npm-package-arg": "11.0.1",
232232
"nuxt": "^3.10.0",

packages/angular/executors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ng-packagr-lite": {
99
"implementation": "./src/executors/ng-packagr-lite/ng-packagr-lite.impl",
1010
"schema": "./src/executors/ng-packagr-lite/schema.json",
11-
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but with some key differences:\n- For supported Angular versions lower than v16, it doesn't run `ngcc` automatically (`ngcc` is no longer available from Angular v16 onwards, for lower versions, it needs to be run separately beforehand if needed, this can be done in a `postinstall` hook on `package.json`).\n- It only produces ESM2022 bundles (ESM2020 for supported Angular versions lower than v16)."
11+
"description": "Builds an Angular library with support for incremental builds.\n\nThis executor is meant to be used with buildable libraries in an incremental build scenario. It is similar to the `@nx/angular:package` executor but it only produces ESM2022 bundles."
1212
},
1313
"package": {
1414
"implementation": "./src/executors/package/package.impl",

0 commit comments

Comments
 (0)