Skip to content

Commit

Permalink
feat(angular): support angular 18.0.0 (#22509)
Browse files Browse the repository at this point in the history
<!-- 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
  • Loading branch information
leosvelperez authored May 23, 2024
1 parent 881adfb commit 37f02f7
Show file tree
Hide file tree
Showing 96 changed files with 3,718 additions and 1,196 deletions.
2 changes: 1 addition & 1 deletion docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"type": "executor"
},
"/nx-api/angular/executors/ng-packagr-lite": {
"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).",
"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.",
"file": "generated/packages/angular/executors/ng-packagr-lite.json",
"hidden": false,
"name": "ng-packagr-lite",
Expand Down
2 changes: 1 addition & 1 deletion docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"type": "executor"
},
{
"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).",
"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.",
"file": "generated/packages/angular/executors/ng-packagr-lite.json",
"hidden": false,
"name": "ng-packagr-lite",
Expand Down
6 changes: 4 additions & 2 deletions docs/generated/packages/angular/executors/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down Expand Up @@ -663,11 +664,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down Expand Up @@ -572,11 +573,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outputCapture": "direct-nodejs",
"$schema": "https://json-schema.org/schema",
"title": "ng-packagr Target",
"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).",
"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.",
"cli": "nx",
"type": "object",
"presets": [
Expand Down Expand Up @@ -44,7 +44,7 @@
"additionalProperties": false,
"required": ["project"]
},
"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).",
"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.",
"aliases": [],
"hidden": false,
"path": "/packages/angular/src/executors/ng-packagr-lite/schema.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down Expand Up @@ -592,11 +593,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down
12 changes: 7 additions & 5 deletions docs/generated/packages/angular/executors/webpack-server.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"properties": {
"assets": {
"type": "array",
"description": "List of static application assets. _Note: only supported in Angular versions >= 15.1.0_",
"description": "List of static application assets.",
"default": [],
"items": {
"oneOf": [
Expand All @@ -38,11 +38,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down Expand Up @@ -186,7 +187,7 @@
},
"vendorChunk": {
"type": "boolean",
"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_",
"description": "Generate a separate bundle containing only vendor libraries. This option should only be used for development to reduce the incremental compilation time.",
"default": false
},
"verbose": {
Expand Down Expand Up @@ -248,7 +249,7 @@
},
"buildOptimizer": {
"type": "boolean",
"description": "Enables advanced build optimizations. _Note: only supported in Angular versions >= 16.0.0_.",
"description": "Enables advanced build optimizations.",
"default": true
},
"namedChunks": {
Expand Down Expand Up @@ -323,11 +324,12 @@
},
"output": {
"type": "string",
"default": "",
"description": "Absolute path within the output."
}
},
"additionalProperties": false,
"required": ["glob", "input", "output"]
"required": ["glob", "input"]
},
{ "type": "string" }
]
Expand Down
7 changes: 4 additions & 3 deletions docs/generated/packages/angular/generators/setup-ssr.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
"appId": {
"type": "string",
"format": "html-selector",
"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._",
"default": "serverApp"
"description": "The `appId` to use with `withServerTransition`.",
"default": "serverApp",
"x-deprecated": "This is deprecated and ignored since Angular 16 and not supported since Angular 17."
},
"main": {
"type": "string",
Expand Down Expand Up @@ -55,7 +56,7 @@
},
"hydration": {
"type": "boolean",
"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_."
"description": "Set up Hydration for the SSR application. It defaults to `true` for Angular versions >= 17.0.0. Otherwise, it defaults to `false`."
},
"skipFormat": {
"type": "boolean",
Expand Down
3 changes: 1 addition & 2 deletions e2e/angular/src/misc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Move Angular Project', () => {
expect(moveOutput).toContain(`CREATE ${newPath}/tsconfig.json`);
expect(moveOutput).toContain(`CREATE ${newPath}/tsconfig.spec.json`);
expect(moveOutput).toContain(`CREATE ${newPath}/.eslintrc.json`);
expect(moveOutput).toContain(`CREATE ${newPath}/src/favicon.ico`);
expect(moveOutput).toContain(`CREATE ${newPath}/public/favicon.ico`);
expect(moveOutput).toContain(`CREATE ${newPath}/src/index.html`);
expect(moveOutput).toContain(`CREATE ${newPath}/src/main.ts`);
expect(moveOutput).toContain(`CREATE ${newPath}/src/styles.css`);
Expand All @@ -52,7 +52,6 @@ describe('Move Angular Project', () => {
);
expect(moveOutput).toContain(`CREATE ${newPath}/src/app/app.component.ts`);
expect(moveOutput).toContain(`CREATE ${newPath}/src/app/app.config.ts`);
expect(moveOutput).toContain(`CREATE ${newPath}/src/assets/.gitkeep`);
});

/**
Expand Down
18 changes: 6 additions & 12 deletions e2e/angular/src/ng-add.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
browser: `apps/${project}/src/main.ts`,
polyfills: [`zone.js`],
tsConfig: `apps/${project}/tsconfig.app.json`,
assets: [
`apps/${project}/src/favicon.ico`,
`apps/${project}/src/assets`,
],
assets: [{ glob: '**/*', input: `apps/${project}/public` }],
styles: [`apps/${project}/src/styles.css`],
scripts: [`apps/${project}/src/scripts.js`],
},
Expand All @@ -197,13 +194,13 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
budgets: [
{
type: 'initial',
maximumWarning: '500kb',
maximumError: '1mb',
maximumWarning: '500kB',
maximumError: '1MB',
},
{
type: 'anyComponentStyle',
maximumWarning: '2kb',
maximumError: '4kb',
maximumWarning: '2kB',
maximumError: '4kB',
},
],
outputHashing: 'all',
Expand All @@ -229,10 +226,7 @@ describe('convert Angular CLI workspace to an Nx workspace', () => {
options: {
polyfills: [`zone.js`, `zone.js/testing`],
tsConfig: `apps/${project}/tsconfig.spec.json`,
assets: [
`apps/${project}/src/favicon.ico`,
`apps/${project}/src/assets`,
],
assets: [{ glob: '**/*', input: `apps/${project}/public` }],
styles: [`apps/${project}/src/styles.css`],
scripts: [`apps/${project}/src/scripts.js`],
},
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular-devkit/architect": "~0.1703.0",
"@angular-devkit/build-angular": "~17.3.0",
"@angular-devkit/core": "~17.3.0",
"@angular-devkit/schematics": "~17.3.0",
"@angular-eslint/eslint-plugin": "17.3.0",
"@angular-eslint/eslint-plugin-template": "17.3.0",
"@angular-eslint/template-parser": "17.3.0",
"@angular/cli": "~17.3.0",
"@angular/common": "~17.3.0",
"@angular/compiler": "~17.3.0",
"@angular/compiler-cli": "~17.3.0",
"@angular/core": "~17.3.0",
"@angular/router": "~17.3.0",
"@angular-devkit/architect": "~0.1800.0",
"@angular-devkit/build-angular": "~18.0.0",
"@angular-devkit/core": "~18.0.0",
"@angular-devkit/schematics": "~18.0.0",
"@angular-eslint/eslint-plugin": "~17.3.0",
"@angular-eslint/eslint-plugin-template": "~17.3.0",
"@angular-eslint/template-parser": "~17.3.0",
"@angular/cli": "~18.0.0",
"@angular/common": "~18.0.0",
"@angular/compiler": "~18.0.0",
"@angular/compiler-cli": "~18.0.0",
"@angular/core": "~18.0.0",
"@angular/router": "~18.0.0",
"@babel/core": "^7.23.2",
"@babel/helper-create-regexp-features-plugin": "^7.22.9",
"@babel/plugin-transform-runtime": "^7.23.2",
Expand Down Expand Up @@ -92,7 +92,7 @@
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-url": "^8.0.2",
"@schematics/angular": "~17.3.0",
"@schematics/angular": "~18.0.0",
"@storybook/addon-essentials": "7.5.3",
"@storybook/core-server": "7.5.3",
"@storybook/react": "7.5.3",
Expand Down Expand Up @@ -226,7 +226,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "9.0.3",
"next-sitemap": "^3.1.10",
"ng-packagr": "~17.3.0",
"ng-packagr": "~18.0.0",
"node-fetch": "^2.6.7",
"npm-package-arg": "11.0.1",
"nuxt": "^3.10.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/executors.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ng-packagr-lite": {
"implementation": "./src/executors/ng-packagr-lite/ng-packagr-lite.impl",
"schema": "./src/executors/ng-packagr-lite/schema.json",
"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)."
"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."
},
"package": {
"implementation": "./src/executors/package/package.impl",
Expand Down
Loading

0 comments on commit 37f02f7

Please sign in to comment.