Skip to content

Commit

Permalink
feat(angular): support angular v19.1 (#29523)
Browse files Browse the repository at this point in the history
Add support for Angular v19.1.x.
  • Loading branch information
leosvelperez authored Jan 16, 2025
1 parent 4d0ebe0 commit 6d8fe5c
Show file tree
Hide file tree
Showing 39 changed files with 2,340 additions and 2,031 deletions.
4 changes: 2 additions & 2 deletions docs/generated/devkit/FileChange.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description of a file change in the Nx virtual file system/

### Properties

- [content](../../devkit/documents/FileChange#content): Buffer
- [content](../../devkit/documents/FileChange#content): Buffer<ArrayBufferLike>
- [options](../../devkit/documents/FileChange#options): TreeWriteOptions
- [path](../../devkit/documents/FileChange#path): string
- [type](../../devkit/documents/FileChange#type): "CREATE" | "DELETE" | "UPDATE"
Expand All @@ -15,7 +15,7 @@ Description of a file change in the Nx virtual file system/

### content

**content**: `Buffer`
**content**: `Buffer`\<`ArrayBufferLike`\>

The content of the file or null in case of delete.

Expand Down
14 changes: 7 additions & 7 deletions docs/generated/devkit/Tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Returns the list of currently recorded changes.

### read

**read**(`filePath`): `Buffer`
**read**(`filePath`): `Buffer`\<`ArrayBufferLike`\>

Read the contents of a file.

Expand All @@ -147,7 +147,7 @@ Read the contents of a file.

#### Returns

`Buffer`
`Buffer`\<`ArrayBufferLike`\>

**read**(`filePath`, `encoding`): `string`

Expand Down Expand Up @@ -193,11 +193,11 @@ Update the contents of a file or create a new file.

#### Parameters

| Name | Type |
| :--------- | :------------------- |
| `filePath` | `string` |
| `content` | `string` \| `Buffer` |
| `options?` | `TreeWriteOptions` |
| Name | Type |
| :--------- | :---------------------------------------- |
| `filePath` | `string` |
| `content` | `string` \| `Buffer`\<`ArrayBufferLike`\> |
| `options?` | `TreeWriteOptions` |

#### Returns

Expand Down
2 changes: 1 addition & 1 deletion docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"type": "executor"
},
"/nx-api/angular/executors/package": {
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` with additional support for incremental builds.",
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` and `@angular/build:ng-packagr` builders, with additional support for incremental builds.",
"file": "generated/packages/angular/executors/package.json",
"hidden": false,
"name": "package",
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 @@ -67,7 +67,7 @@
"type": "executor"
},
{
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` with additional support for incremental builds.",
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` and `@angular/build:ng-packagr` builders, with additional support for incremental builds.",
"file": "generated/packages/angular/executors/package.json",
"hidden": false,
"name": "package",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We provide a recommended version, and it is usually the latest minor version of

| Angular Version | **Nx Version _(recommended)_** | Nx Version _(range)_ |
| --------------- | ------------------------------ | ---------------------------------------- |
| ~19.1.0 | **latest** | >=20.4.0 <=latest |
| ~19.0.0 | **latest** | >=20.2.0 <=latest |
| ~18.2.0 | **latest** | >=19.6.0 <=latest |
| ~18.1.0 | **latest** | >=19.5.0 <=latest |
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/packages/angular/executors/package.json
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 and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` with additional support for incremental builds.",
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` and `@angular/build:ng-packagr` builders, with additional support for incremental builds.",
"cli": "nx",
"type": "object",
"presets": [
Expand Down Expand Up @@ -44,7 +44,7 @@
"project"
]
},
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` with additional support for incremental builds.",
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` and `@angular/build:ng-packagr` builders, with additional support for incremental builds.",
"aliases": [],
"hidden": false,
"path": "/packages/angular/src/executors/package/schema.json",
Expand Down
1 change: 1 addition & 0 deletions docs/shared/packages/angular/angular-nx-version-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We provide a recommended version, and it is usually the latest minor version of

| Angular Version | **Nx Version _(recommended)_** | Nx Version _(range)_ |
| --------------- | ------------------------------ | ---------------------------------------- |
| ~19.1.0 | **latest** | >=20.4.0 <=latest |
| ~19.0.0 | **latest** | >=20.2.0 <=latest |
| ~18.2.0 | **latest** | >=19.6.0 <=latest |
| ~18.1.0 | **latest** | >=19.5.0 <=latest |
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular-devkit/architect": "~0.1900.0",
"@angular-devkit/build-angular": "~19.0.0",
"@angular-devkit/core": "~19.0.0",
"@angular-devkit/schematics": "~19.0.0",
"@angular-devkit/architect": "~0.1901.0",
"@angular-devkit/build-angular": "~19.1.0",
"@angular-devkit/core": "~19.1.0",
"@angular-devkit/schematics": "~19.1.0",
"@angular-eslint/eslint-plugin": "19.0.2",
"@angular-eslint/eslint-plugin-template": "19.0.2",
"@angular-eslint/template-parser": "19.0.2",
"@angular/cli": "~19.0.0",
"@angular/common": "~19.0.0",
"@angular/compiler": "~19.0.0",
"@angular/compiler-cli": "~19.0.0",
"@angular/core": "~19.0.0",
"@angular/router": "~19.0.0",
"@angular/cli": "~19.1.0",
"@angular/common": "~19.1.0",
"@angular/compiler": "~19.1.0",
"@angular/compiler-cli": "~19.1.0",
"@angular/core": "~19.1.0",
"@angular/router": "~19.1.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 @@ -107,7 +107,7 @@
"@rspack/dev-server": "1.0.9",
"@rspack/plugin-minify": "^0.7.5",
"@rspack/plugin-react-refresh": "^1.0.0",
"@schematics/angular": "~19.0.0",
"@schematics/angular": "~19.1.0",
"@storybook/addon-essentials": "8.4.6",
"@storybook/addon-interactions": "8.4.6",
"@storybook/core-server": "8.4.6",
Expand Down Expand Up @@ -146,10 +146,10 @@
"@types/tmp": "^0.2.0",
"@types/yargs": "17.0.10",
"@types/yarnpkg__lockfile": "^1.1.5",
"@typescript-eslint/eslint-plugin": "^8.13.0",
"@typescript-eslint/rule-tester": "^8.13.0",
"@typescript-eslint/type-utils": "^8.13.0",
"@typescript-eslint/utils": "^8.13.0",
"@typescript-eslint/eslint-plugin": "^8.19.0",
"@typescript-eslint/rule-tester": "^8.19.0",
"@typescript-eslint/type-utils": "^8.19.0",
"@typescript-eslint/utils": "^8.19.0",
"@xstate/immer": "0.3.1",
"@xstate/inspect": "0.7.0",
"@xstate/react": "3.0.1",
Expand Down Expand Up @@ -246,7 +246,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "9.0.3",
"next-sitemap": "^3.1.10",
"ng-packagr": "~19.0.0",
"ng-packagr": "~19.1.0",
"node-fetch": "^2.6.7",
"npm-package-arg": "11.0.1",
"nuxt": "^3.10.0",
Expand Down Expand Up @@ -299,8 +299,8 @@
"tsconfig-paths-webpack-plugin": "4.0.0",
"typedoc": "0.25.12",
"typedoc-plugin-markdown": "3.17.1",
"typescript": "~5.6.2",
"typescript-eslint": "^8.13.0",
"typescript": "~5.7.2",
"typescript-eslint": "^8.19.0",
"unist-builder": "^4.0.0",
"use-sync-external-store": "^1.2.0",
"verdaccio": "^5.30.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 @@ -13,7 +13,7 @@
"package": {
"implementation": "./src/executors/package/package.impl",
"schema": "./src/executors/package/schema.json",
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` with additional support for incremental builds."
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` and `@angular/build:ng-packagr` builders, with additional support for incremental builds."
},
"browser-esbuild": {
"implementation": "./src/executors/browser-esbuild/browser-esbuild.impl",
Expand Down
70 changes: 70 additions & 0 deletions packages/angular/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,15 @@
"version": "20.3.0-beta.2",
"description": "If workspace includes Module Federation projects, ensure the new @nx/module-federation package is installed.",
"factory": "./src/migrations/update-20-3-0/ensure-nx-module-federation-package"
},
"update-angular-cli-version-19-1-0": {
"cli": "nx",
"version": "20.4.0-beta.1",
"requires": {
"@angular/core": ">=19.1.0"
},
"description": "Update the @angular/cli package version to ~19.1.0.",
"factory": "./src/migrations/update-20-4-0/update-angular-cli"
}
},
"packageJsonUpdates": {
Expand Down Expand Up @@ -1415,6 +1424,67 @@
"alwaysAddToPackageJson": false
}
}
},
"20.4.0": {
"version": "20.4.0-beta.1",
"x-prompt": "Do you want to update the Angular version to v19.1?",
"requires": {
"@angular/core": ">=19.0.0 <19.1.0"
},
"packages": {
"@angular-devkit/build-angular": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@angular/build": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@angular/pwa": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@angular/ssr": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/architect": {
"version": "~0.1901.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.1901.0",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~19.1.0",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~19.1.0",
"alwaysAddToPackageJson": false
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/angular/src/executors/package/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"outputCapture": "direct-nodejs",
"$schema": "https://json-schema.org/schema",
"title": "ng-packagr Target",
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` with additional support for incremental builds.",
"description": "Builds and packages an Angular library producing an output following the Angular Package Format (APF) to be distributed as an NPM package.\n\nThis executor is a drop-in replacement for the `@angular-devkit/build-angular:ng-packagr` and `@angular/build:ng-packagr` builders, with additional support for incremental builds.",
"cli": "nx",
"type": "object",
"presets": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('addLinting generator', () => {

const { devDependencies } = readJson(tree, 'package.json');
expect(devDependencies['@typescript-eslint/utils']).toMatchInlineSnapshot(
`"^8.13.0"`
`"^8.19.0"`
);
delete process.env.ESLINT_USE_FLAT_CONFIG;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { MoveImplOptions } from './types';

const libraryExecutors = [
'@angular-devkit/build-angular:ng-packagr',
'@angular/build:ng-packagr',
'@nx/angular:ng-packagr-lite',
'@nx/angular:package',
// TODO(v17): remove when @nrwl/* scope is removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class AngularDevkitKarmaMigrator extends BuilderMigrator {
) {
super(
tree,
'@angular-devkit/build-angular:karma',
['@angular-devkit/build-angular:karma'],
'karma',
project,
projectConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class AngularDevkitNgPackagrMigrator extends BuilderMigrator {
) {
super(
tree,
'@angular-devkit/build-angular:ng-packagr',
['@angular-devkit/build-angular:ng-packagr', '@angular/build:ng-packagr'],
undefined,
project,
projectConfig,
Expand All @@ -39,8 +39,11 @@ export class AngularDevkitNgPackagrMigrator extends BuilderMigrator {

if (!this.targets.size) {
this.logger.warn(
`There is no target in the project configuration using the ${this.builderName} builder. This might not be an issue. ` +
`Skipping updating the build configuration.`
`There is no target in the project configuration using the ${this.possibleBuilderNames
.map((b) => `"${b}"`)
.join(', ')} builder${
this.possibleBuilderNames.length > 1 ? 's' : ''
}. This might not be an issue. Skipping updating the build configuration.`
);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class AngularEslintLintMigrator extends BuilderMigrator {
) {
super(
tree,
'@angular-eslint/builder:lint',
['@angular-eslint/builder:lint'],
'eslint',
project,
projectConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export abstract class BuilderMigrator extends Migrator {

constructor(
tree: Tree,
public readonly builderName: string,
public readonly possibleBuilderNames: string[],
public readonly rootFileType: WorkspaceRootFileType | undefined,
project: ProjectMigrationInfo,
projectConfig: ProjectConfiguration,
Expand All @@ -40,9 +40,9 @@ export abstract class BuilderMigrator extends Migrator {
// expanding what's supported.
if (this.targets.size > 1) {
errors.push({
message: `There is more than one target using the builder "${
this.builderName
}": ${arrayToString([
message: `There is more than one target using the builder${
this.possibleBuilderNames.length > 1 ? 's' : ''
} ${arrayToString(this.possibleBuilderNames)}: ${arrayToString([
...this.targets.keys(),
])}. This is not currently supported by the automated migration. These targets will be skipped.`,
hint: 'Make sure to manually migrate their configuration and any possible associated files.',
Expand All @@ -61,7 +61,7 @@ export abstract class BuilderMigrator extends Migrator {
for (const [name, target] of Object.entries(
this.projectConfig.targets ?? {}
)) {
if (target.executor === this.builderName) {
if (this.possibleBuilderNames.includes(target.executor)) {
this.targets.set(name, target);
}
}
Expand Down
Loading

0 comments on commit 6d8fe5c

Please sign in to comment.