Skip to content

feat(angular): support angular 20.0.0-next.9 #31000

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

Merged
merged 1 commit into from
May 2, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,14 @@
}
},
"migrations": {
"/nx-api/angular/migrations/update-angular-cli-version-20-0-0-next-5": {
"description": "Update the @angular/cli package version to ~20.0.0-next.5.",
"file": "generated/packages/angular/migrations/update-angular-cli-version-20-0-0-next-5.json",
"/nx-api/angular/migrations/update-angular-cli-version-20-0-0-next-9": {
"description": "Update the @angular/cli package version to 20.0.0-next.9.",
"file": "generated/packages/angular/migrations/update-angular-cli-version-20-0-0-next-9.json",
"hidden": false,
"name": "update-angular-cli-version-20-0-0-next-5",
"name": "update-angular-cli-version-20-0-0-next-9",
"version": "21.2.0-beta.0",
"originalFilePath": "/packages/angular",
"path": "/nx-api/angular/migrations/update-angular-cli-version-20-0-0-next-5",
"path": "/nx-api/angular/migrations/update-angular-cli-version-20-0-0-next-9",
"type": "migration"
},
"/nx-api/angular/migrations/21.2.0-package-updates": {
Expand Down
8 changes: 4 additions & 4 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,13 @@
],
"migrations": [
{
"description": "Update the @angular/cli package version to ~20.0.0-next.5.",
"file": "generated/packages/angular/migrations/update-angular-cli-version-20-0-0-next-5.json",
"description": "Update the @angular/cli package version to 20.0.0-next.9.",
"file": "generated/packages/angular/migrations/update-angular-cli-version-20-0-0-next-9.json",
"hidden": false,
"name": "update-angular-cli-version-20-0-0-next-5",
"name": "update-angular-cli-version-20-0-0-next-9",
"version": "21.2.0-beta.0",
"originalFilePath": "/packages/angular",
"path": "angular/migrations/update-angular-cli-version-20-0-0-next-5",
"path": "angular/migrations/update-angular-cli-version-20-0-0-next-9",
"type": "migration"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,61 @@
"name": "21.2.0-package-updates",
"version": "21.2.0-beta.0",
"x-prompt": "Do you want to update the Angular version to v20?",
"requires": { "@angular/core": ">=19.2.0 <20.0.0-next.6" },
"requires": { "@angular/core": ">=19.2.0 <20.0.0-next.9" },
"packages": {
"@angular-devkit/build-angular": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/build": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/pwa": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/ssr": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/architect": {
"version": "~0.2000.0-next.5",
"version": "0.2000.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.2000.0-next.5",
"version": "0.2000.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.10",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.10",
"alwaysAddToPackageJson": false
},
"@angular/google-maps": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.10",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~20.0.0-next.6",
"alwaysAddToPackageJson": false
}
"ng-packagr": { "version": "20.0.0-rc.0", "alwaysAddToPackageJson": false }
},
"aliases": [],
"description": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "update-angular-cli-version-20-0-0-next-5",
"name": "update-angular-cli-version-20-0-0-next-9",
"cli": "nx",
"version": "21.2.0-beta.0",
"requires": { "@angular/core": ">=20.0.0-next.6" },
"description": "Update the @angular/cli package version to ~20.0.0-next.5.",
"requires": { "@angular/core": ">=20.0.0-next.9" },
"description": "Update the @angular/cli package version to 20.0.0-next.9.",
"factory": "./src/migrations/update-21-2-0/update-angular-cli",
"implementation": "/packages/angular/src/migrations/update-21-2-0/update-angular-cli.ts",
"aliases": [],
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular-devkit/architect": "0.2000.0-next.5",
"@angular-devkit/build-angular": "20.0.0-next.5",
"@angular-devkit/core": "20.0.0-next.5",
"@angular-devkit/schematics": "20.0.0-next.5",
"@angular-devkit/architect": "0.2000.0-next.9",
"@angular-devkit/build-angular": "20.0.0-next.9",
"@angular-devkit/core": "20.0.0-next.9",
"@angular-devkit/schematics": "20.0.0-next.9",
"@angular-eslint/eslint-plugin": "19.2.0",
"@angular-eslint/eslint-plugin-template": "19.2.0",
"@angular-eslint/template-parser": "19.2.0",
"@angular/cli": "20.0.0-next.5",
"@angular/common": "20.0.0-next.6",
"@angular/compiler": "20.0.0-next.6",
"@angular/compiler-cli": "20.0.0-next.6",
"@angular/core": "20.0.0-next.6",
"@angular/platform-browser": "20.0.0-next.6",
"@angular/router": "20.0.0-next.6",
"@angular/cli": "20.0.0-next.9",
"@angular/common": "20.0.0-next.9",
"@angular/compiler": "20.0.0-next.9",
"@angular/compiler-cli": "20.0.0-next.9",
"@angular/core": "20.0.0-next.9",
"@angular/platform-browser": "20.0.0-next.9",
"@angular/router": "20.0.0-next.9",
"@astrojs/check": "^0.7.0",
"@astrojs/react": "^3.6.2",
"@babel/core": "^7.23.2",
Expand Down Expand Up @@ -114,7 +114,7 @@
"@rspack/dev-server": "1.0.9",
"@rspack/plugin-minify": "^0.7.5",
"@rspack/plugin-react-refresh": "^1.0.0",
"@schematics/angular": "20.0.0-next.5",
"@schematics/angular": "20.0.0-next.9",
"@storybook/addon-essentials": "8.4.6",
"@storybook/addon-interactions": "8.4.6",
"@storybook/core-server": "8.4.6",
Expand Down Expand Up @@ -264,7 +264,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "9.0.3",
"next-sitemap": "^3.1.10",
"ng-packagr": "20.0.0-next.6",
"ng-packagr": "20.0.0-rc.0",
"npm-package-arg": "11.0.1",
"nuxt": "^3.10.0",
"nx": "21.0.0-rc.1",
Expand Down Expand Up @@ -326,7 +326,7 @@
"verdaccio": "6.0.5",
"vite": "6.2.0",
"vitest": "3.0.5",
"webpack": "5.99.5",
"webpack": "5.99.7",
"webpack-dev-server": "5.2.1",
"webpack-merge": "^5.8.0",
"webpack-node-externals": "^3.0.0",
Expand Down
36 changes: 18 additions & 18 deletions packages/angular/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,13 +303,13 @@
"description": "Change the data persistence operator imports to '@ngrx/router-store/data-persistence'.",
"factory": "./src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence"
},
"update-angular-cli-version-20-0-0-next-5": {
"update-angular-cli-version-20-0-0-next-9": {
"cli": "nx",
"version": "21.2.0-beta.0",
"requires": {
"@angular/core": ">=20.0.0-next.6"
"@angular/core": ">=20.0.0-next.9"
},
"description": "Update the @angular/cli package version to ~20.0.0-next.5.",
"description": "Update the @angular/cli package version to 20.0.0-next.9.",
"factory": "./src/migrations/update-21-2-0/update-angular-cli"
}
},
Expand Down Expand Up @@ -1629,63 +1629,63 @@
"version": "21.2.0-beta.0",
"x-prompt": "Do you want to update the Angular version to v20?",
"requires": {
"@angular/core": ">=19.2.0 <20.0.0-next.6"
"@angular/core": ">=19.2.0 <20.0.0-next.9"
},
"packages": {
"@angular-devkit/build-angular": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/build": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/pwa": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/ssr": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~20.0.0-next.5",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/architect": {
"version": "~0.2000.0-next.5",
"version": "0.2000.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.2000.0-next.5",
"version": "0.2000.0-next.9",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.9",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.10",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.10",
"alwaysAddToPackageJson": false
},
"@angular/google-maps": {
"version": "~20.0.0-next.6",
"version": "20.0.0-next.10",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~20.0.0-next.6",
"version": "20.0.0-rc.0",
"alwaysAddToPackageJson": false
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {
DestinationFiles,
NgEntryPoint as NgEntryPointBase,
} from 'ng-packagr/lib/ng-package/entry-point/entry-point';
import type { NgPackageConfig } from 'ng-packagr/ng-package.schema';
} from 'ng-packagr/src/lib/ng-package/entry-point/entry-point';
import type { NgPackageConfig } from 'ng-packagr/src/ng-package.schema';
import { dirname } from 'node:path';
import { getNgPackagrVersionInfo } from '../../../../utilities/ng-packagr/ng-packagr-version';
import { importNgPackagrPath } from '../../../../utilities/ng-packagr/package-imports';
Expand All @@ -16,8 +16,11 @@ export function createNgEntryPoint(
const { major: ngPackagrMajorVersion } = getNgPackagrVersionInfo();

const { NgEntryPoint: NgEntryPointBase } = importNgPackagrPath<
typeof import('ng-packagr/lib/ng-package/entry-point/entry-point')
>('ng-packagr/lib/ng-package/entry-point/entry-point', ngPackagrMajorVersion);
typeof import('ng-packagr/src/lib/ng-package/entry-point/entry-point')
>(
'ng-packagr/src/lib/ng-package/entry-point/entry-point',
ngPackagrMajorVersion
);

class NgEntryPoint extends NgEntryPointBase {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TransformProvider } from 'ng-packagr/lib/graph/transform.di';
import type { TransformProvider } from 'ng-packagr/src/lib/graph/transform.di';
import { getNgPackagrVersionInfo } from '../../../../utilities/ng-packagr/ng-packagr-version';
import { importNgPackagrPath } from '../../../../utilities/ng-packagr/package-imports';
import { writeBundlesTransform } from './write-bundles.transform';
Expand All @@ -7,17 +7,17 @@ export function getWriteBundlesTransformProvider(): TransformProvider {
const { major: ngPackagrMajorVersion } = getNgPackagrVersionInfo();

const { provideTransform } = importNgPackagrPath<
typeof import('ng-packagr/lib/graph/transform.di')
>('ng-packagr/lib/graph/transform.di', ngPackagrMajorVersion);
typeof import('ng-packagr/src/lib/graph/transform.di')
>('ng-packagr/src/lib/graph/transform.di', ngPackagrMajorVersion);
const { WRITE_BUNDLES_TRANSFORM_TOKEN } = importNgPackagrPath<
typeof import('ng-packagr/lib/ng-package/entry-point/write-bundles.di')
typeof import('ng-packagr/src/lib/ng-package/entry-point/write-bundles.di')
>(
'ng-packagr/lib/ng-package/entry-point/write-bundles.di',
'ng-packagr/src/lib/ng-package/entry-point/write-bundles.di',
ngPackagrMajorVersion
);
const { OPTIONS_TOKEN } = importNgPackagrPath<
typeof import('ng-packagr/lib/ng-package/options.di')
>('ng-packagr/lib/ng-package/options.di', ngPackagrMajorVersion);
typeof import('ng-packagr/src/lib/ng-package/options.di')
>('ng-packagr/src/lib/ng-package/options.di', ngPackagrMajorVersion);

return provideTransform({
provide: WRITE_BUNDLES_TRANSFORM_TOKEN,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* - Fake the FESM2022 outputs pointing them to the ESM2022 outputs.
*/

import type { NgEntryPoint } from 'ng-packagr/lib/ng-package/entry-point/entry-point';
import type { NgPackagrOptions } from 'ng-packagr/lib/ng-package/options.di';
import type { NgEntryPoint } from 'ng-packagr/src/lib/ng-package/entry-point/entry-point';
import type { NgPackagrOptions } from 'ng-packagr/src/lib/ng-package/options.di';
import { mkdir, writeFile } from 'node:fs/promises';
import { dirname } from 'node:path';
import { getNgPackagrVersionInfo } from '../../../../utilities/ng-packagr/ng-packagr-version';
Expand All @@ -19,17 +19,17 @@ export const writeBundlesTransform = (_options: NgPackagrOptions) => {
const { major: ngPackagrMajorVersion } = getNgPackagrVersionInfo();

const { BuildGraph } = importNgPackagrPath<
typeof import('ng-packagr/lib/graph/build-graph')
>('ng-packagr/lib/graph/build-graph', ngPackagrMajorVersion);
typeof import('ng-packagr/src/lib/graph/build-graph')
>('ng-packagr/src/lib/graph/build-graph', ngPackagrMajorVersion);
const { transformFromPromise } = importNgPackagrPath<
typeof import('ng-packagr/lib/graph/transform')
>('ng-packagr/lib/graph/transform', ngPackagrMajorVersion);
typeof import('ng-packagr/src/lib/graph/transform')
>('ng-packagr/src/lib/graph/transform', ngPackagrMajorVersion);
const { isEntryPoint, isPackage } = importNgPackagrPath<
typeof import('ng-packagr/lib/ng-package/nodes')
>('ng-packagr/lib/ng-package/nodes', ngPackagrMajorVersion);
typeof import('ng-packagr/src/lib/ng-package/nodes')
>('ng-packagr/src/lib/ng-package/nodes', ngPackagrMajorVersion);
const { NgPackage } = importNgPackagrPath<
typeof import('ng-packagr/lib/ng-package/package')
>('ng-packagr/lib/ng-package/package', ngPackagrMajorVersion);
typeof import('ng-packagr/src/lib/ng-package/package')
>('ng-packagr/src/lib/ng-package/package', ngPackagrMajorVersion);

return transformFromPromise(async (graph) => {
const updatedGraph = new BuildGraph();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
type NgPackagrImportPath = `ng-packagr/src/${string}`;

export function importNgPackagrPath<T>(
path: string,
path: NgPackagrImportPath,
ngPackagrMajorVersion: number
): T {
let finalPath = path;
let finalPath: string = path;

if (ngPackagrMajorVersion >= 20 && !path.startsWith('ng-packagr/src/')) {
finalPath = path.replace(/^ng-packagr\//, 'ng-packagr/src/');
if (ngPackagrMajorVersion < 20 && path.startsWith('ng-packagr/src/')) {
finalPath = path.replace(/^ng-packagr\/src\//, 'ng-packagr/');
}

return require(finalPath);
Expand Down
Loading
Loading