feat(angular): support angular 16.2.0 RC (#17879)

This commit is contained in:
Colum Ferry 2023-08-08 16:43:28 +01:00 committed by GitHub
parent 8be2a268b7
commit d7d3ebc3a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 862 additions and 1952 deletions

View File

@ -27,19 +27,19 @@
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular-devkit/architect": "~0.1601.0",
"@angular-devkit/build-angular": "~16.1.0",
"@angular-devkit/core": "~16.1.0",
"@angular-devkit/schematics": "~16.1.0",
"@angular-devkit/architect": "~0.1602.0-rc.1",
"@angular-devkit/build-angular": "~16.2.0-rc.1",
"@angular-devkit/core": "~16.2.0-rc.1",
"@angular-devkit/schematics": "~16.2.0-rc.1",
"@angular-eslint/eslint-plugin": "~16.0.0",
"@angular-eslint/eslint-plugin-template": "~16.0.0",
"@angular-eslint/template-parser": "~16.0.0",
"@angular/cli": "~16.1.0",
"@angular/common": "~16.1.0",
"@angular/compiler": "~16.1.0",
"@angular/compiler-cli": "~16.1.0",
"@angular/core": "~16.1.0",
"@angular/router": "~16.1.0",
"@angular/cli": "~16.2.0-rc.1",
"@angular/common": "~16.2.0-rc.0",
"@angular/compiler": "~16.2.0-rc.0",
"@angular/compiler-cli": "~16.2.0-rc.0",
"@angular/core": "~16.2.0-rc.0",
"@angular/router": "~16.2.0-rc.0",
"@babel/core": "^7.22.9",
"@babel/helper-create-regexp-features-plugin": "^7.22.9",
"@babel/plugin-transform-runtime": "^7.22.9",
@ -62,7 +62,7 @@
"@ngrx/effects": "~16.0.0",
"@ngrx/router-store": "~16.0.0",
"@ngrx/store": "~16.0.0",
"@nguniversal/builders": "~16.1.0",
"@nguniversal/builders": "~16.2.0-rc.0",
"@nx/cypress": "16.6.0-beta.8",
"@nx/devkit": "16.6.0-beta.8",
"@nx/eslint-plugin": "16.6.0-beta.8",
@ -86,7 +86,7 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-url": "^7.0.0",
"@schematics/angular": "~16.1.0",
"@schematics/angular": "~16.2.0-rc.1",
"@side/jest-runtime": "^1.1.0",
"@storybook/addon-essentials": "^7.1.1",
"@storybook/core-server": "^7.1.1",
@ -217,7 +217,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "3.0.5",
"next-sitemap": "^3.1.10",
"ng-packagr": "~16.1.0",
"ng-packagr": "~16.2.0-next.1",
"node-fetch": "^2.6.7",
"nx": "16.6.0-beta.8",
"nx-cloud": "16.3.0-beta.7",
@ -362,6 +362,10 @@
"pnpm": {
"patchedDependencies": {
"lerna@6.6.2": "patches/lerna@6.6.2.patch"
},
"overrides": {
"@angular-devkit/core": "$@angular-devkit/core"
}
}
}

View File

@ -269,6 +269,15 @@
"version": "16.6.0-beta.0",
"description": "Explicitly set 'updateBuildableProjectDepsInPackageJson' to 'true' in targets that rely on that value as the default.",
"factory": "./src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps"
},
"update-angular-cli-version-16-2-0-rc-1": {
"cli": "nx",
"version": "16.7.0-beta.0",
"requires": {
"@angular/core": ">=16.2.0-rc.0"
},
"description": "Update the @angular/cli package version to ~16.2.0-rc.1.",
"factory": "./src/migrations/update-16-7-0/update-angular-cli"
}
},
"packageJsonUpdates": {
@ -1235,6 +1244,67 @@
"alwaysAddToPackageJson": false
}
}
},
"16.7.0": {
"version": "16.7.0-beta.2",
"packages": {
"@angular-devkit/architect": {
"version": "~0.1602.0-rc.1",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-angular": {
"version": "~16.2.0-rc.1",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.1602.0-rc.1",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~16.2.0-rc.1",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~16.2.0-rc.1",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~16.2.0-rc.0",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~16.2.0-rc.0",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~16.2.0-rc.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/builders": {
"version": "~16.2.0-rc.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/common": {
"version": "~16.2.0-rc.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/express-engine": {
"version": "~16.2.0-rc.0",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~16.2.0-rc.1",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~16.2.0-next.1",
"alwaysAddToPackageJson": false
}
},
"x-prompt": "Do you want to update the Angular version to v16.2?",
"requires": {
"@angular/core": ">=16.1.0 <16.2.0-next.1"
}
}
}
}

View File

@ -16,7 +16,7 @@ import { findMatchingProjects } from 'nx/src/utils/find-matching-projects';
export function executeModuleFederationDevServerBuilder(
schema: Schema,
context: import('@angular-devkit/architect').BuilderContext
) {
): ReturnType<typeof executeWebpackDevServerBuilder> {
const { ...options } = schema;
const projectGraph = readCachedProjectGraph();
const { projects: workspaceProjects } =

View File

@ -0,0 +1,42 @@
import { readJson, Tree, writeJson } from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import updateAngularCli, { angularCliVersion } from './update-angular-cli';
describe('update-angular-cli migration', () => {
let tree: Tree;
beforeEach(() => {
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
});
it('should update @angular/cli version when defined as a dev dependency', async () => {
writeJson(tree, 'package.json', {
devDependencies: { '@angular/cli': '~13.3.0' },
});
await updateAngularCli(tree);
const { devDependencies } = readJson(tree, 'package.json');
expect(devDependencies['@angular/cli']).toBe(angularCliVersion);
});
it('should update @angular/cli version when defined as a dependency', async () => {
writeJson(tree, 'package.json', {
dependencies: { '@angular/cli': '~13.3.0' },
});
await updateAngularCli(tree);
const { dependencies } = readJson(tree, 'package.json');
expect(dependencies['@angular/cli']).toBe(angularCliVersion);
});
it('should not add @angular/cli to package.json when it is not set', async () => {
const initialPackageJson = readJson(tree, 'package.json');
await updateAngularCli(tree);
const packageJson = readJson(tree, 'package.json');
expect(packageJson).toStrictEqual(initialPackageJson);
});
});

View File

@ -0,0 +1,23 @@
import { formatFiles, Tree, updateJson } from '@nx/devkit';
export const angularCliVersion = '~16.2.0-rc.1';
export default async function (tree: Tree) {
let shouldFormat = false;
updateJson(tree, 'package.json', (json) => {
if (json.devDependencies?.['@angular/cli']) {
json.devDependencies['@angular/cli'] = angularCliVersion;
shouldFormat = true;
} else if (json.dependencies?.['@angular/cli']) {
json.dependencies['@angular/cli'] = angularCliVersion;
shouldFormat = true;
}
return json;
});
if (shouldFormat) {
await formatFiles(tree);
}
}

View File

@ -1,15 +1,15 @@
export const nxVersion = require('../../package.json').version;
export const angularVersion = '~16.1.0';
export const angularDevkitVersion = '~16.1.0';
export const ngPackagrVersion = '~16.1.0';
export const angularVersion = '~16.2.0-rc.0';
export const angularDevkitVersion = '~16.2.0-rc.1';
export const ngPackagrVersion = '~16.2.0-next.1';
export const ngrxVersion = '~16.0.0';
export const rxjsVersion = '~7.8.0';
export const zoneJsVersion = '~0.13.0';
export const angularJsVersion = '1.7.9';
export const tsLibVersion = '^2.3.0';
export const ngUniversalVersion = '~16.1.0';
export const ngUniversalVersion = '~16.2.0-rc.0';
export const corsVersion = '~2.8.5';
export const typesCorsVersion = '~2.8.5';
export const expressVersion = '~4.18.2';

View File

@ -4,4 +4,4 @@ export const typescriptVersion = '~5.1.3';
// TODO: remove when preset generation is reworked and
// deps are not installed from workspace
export const angularCliVersion = '~16.1.0';
export const angularCliVersion = '~16.2.0-rc.1';

2637
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff