Skip to content

Commit

Permalink
feat(angular): support Angular 15.2 (#14953)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Feb 23, 2023
1 parent cddfa09 commit 9efcf04
Show file tree
Hide file tree
Showing 11 changed files with 635 additions and 477 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
},
"verbose": {
"type": "boolean",
"description": "Adds more details to output logging."
"description": "Adds more details to output logging.",
"default": false
},
"pathToManifestFile": {
"type": "string",
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
"preinstall": "node ./scripts/preinstall.js"
},
"devDependencies": {
"@angular-devkit/architect": "~0.1501.0",
"@angular-devkit/build-angular": "~15.1.0",
"@angular-devkit/core": "~15.1.0",
"@angular-devkit/schematics": "~15.1.0",
"@angular-devkit/architect": "~0.1502.0",
"@angular-devkit/build-angular": "~15.2.0",
"@angular-devkit/core": "~15.2.0",
"@angular-devkit/schematics": "~15.2.0",
"@angular-eslint/eslint-plugin": "~15.0.0",
"@angular-eslint/eslint-plugin-template": "~15.0.0",
"@angular-eslint/template-parser": "~15.0.0",
"@angular/cli": "~15.1.0",
"@angular/common": "~15.1.0",
"@angular/compiler": "~15.1.0",
"@angular/compiler-cli": "~15.1.0",
"@angular/core": "~15.1.0",
"@angular/router": "~15.1.0",
"@angular/cli": "~15.2.0",
"@angular/common": "~15.2.0",
"@angular/compiler": "~15.2.0",
"@angular/compiler-cli": "~15.2.0",
"@angular/core": "~15.2.0",
"@angular/router": "~15.2.0",
"@babel/core": "^7.15.0",
"@babel/helper-create-regexp-features-plugin": "^7.14.5",
"@babel/preset-react": "^7.14.5",
Expand All @@ -57,7 +57,7 @@
"@ngrx/effects": "~15.0.0",
"@ngrx/router-store": "~15.0.0",
"@ngrx/store": "~15.0.0",
"@nguniversal/builders": "~15.1.0",
"@nguniversal/builders": "~15.2.0",
"@nrwl/cypress": "15.7.2",
"@nrwl/devkit": "15.7.2",
"@nrwl/eslint-plugin-nx": "15.7.2",
Expand All @@ -81,7 +81,7 @@
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.4",
"@rollup/plugin-url": "^7.0.0",
"@schematics/angular": "~15.1.0",
"@schematics/angular": "~15.2.0",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/angular": "^6.5.15",
"@storybook/builder-webpack5": "^6.5.15",
Expand Down Expand Up @@ -194,7 +194,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "3.0.5",
"next-sitemap": "^3.1.10",
"ng-packagr": "~15.1.0",
"ng-packagr": "~15.2.2",
"node-fetch": "^2.6.7",
"nx": "15.7.2",
"open": "^8.4.0",
Expand Down
68 changes: 68 additions & 0 deletions packages/angular/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@
"version": "15.7.0-beta.1",
"description": "Install the required angular-devkit packages as we do not directly depend on them anymore",
"factory": "./src/migrations/update-15-7-0/install-required-packages"
},
"update-angular-cli-version-15-2-0": {
"cli": "nx",
"version": "15.8.0-beta.4",
"description": "Update the @angular/cli package version to ~15.2.0.",
"factory": "./src/migrations/update-15-8-0/update-angular-cli"
}
},
"packageJsonUpdates": {
Expand Down Expand Up @@ -1836,6 +1842,68 @@
"alwaysAddToPackageJson": false
}
}
},
"15.8.0": {
"version": "15.8.0-beta.4",
"x-prompt": "Do you want to update the Angular version to v15.2?",
"requires": {
"@angular/core": ">=15.1.0 <15.2.0",
"typescript": ">=4.8.2 <5.0"
},
"packages": {
"@angular-devkit/architect": {
"version": "~0.1502.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-angular": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.1502.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~15.2.0",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/express-engine": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/build-angular": {
"version": "~15.2.0",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~15.2.2",
"alwaysAddToPackageJson": false
},
"zone.js": {
"version": "~0.12.0",
"alwaysAddToPackageJson": false
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ export interface Schema {
proxyConfig?: string;
devRemotes?: string[];
skipRemotes?: string[];
verbose?: boolean;
verbose: boolean;
pathToManifestFile?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
},
"verbose": {
"type": "boolean",
"description": "Adds more details to output logging."
"description": "Adds more details to output logging.",
"default": false
},
"pathToManifestFile": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { readJson, Tree, writeJson } from '@nrwl/devkit';
import { createTreeWithEmptyWorkspace } from '@nrwl/devkit/testing';
import updateAngularCli 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']).toEqual('~15.2.0');
});

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']).toEqual('~15.2.0');
});

it('should 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);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { formatFiles, Tree, updateJson } from '@nrwl/devkit';

const angularCliVersion = '~15.2.0';

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);
}
}
8 changes: 4 additions & 4 deletions packages/angular/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const nxVersion = require('../../package.json').version;

export const angularVersion = '~15.1.0';
export const angularDevkitVersion = '~15.1.0';
export const ngPackagrVersion = '~15.1.0';
export const angularVersion = '~15.2.0';
export const angularDevkitVersion = '~15.2.0';
export const ngPackagrVersion = '~15.2.2';
export const ngrxVersion = '~15.0.0';
export const rxjsVersion = '~7.8.0';
export const zoneJsVersion = '~0.11.4';
export const zoneJsVersion = '~0.12.0';
export const angularJsVersion = '1.7.9';
export const tsLibVersion = '^2.3.0';

Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const nxVersion = require('../../package.json').version;

export const angularCliVersion = '~15.1.0';
export const angularCliVersion = '~15.2.0';
export const typescriptVersion = '~4.9.5';
export const prettierVersion = '^2.6.2';
export const typescriptESLintVersion = '^5.36.1';
Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const nxVersion = require('../../package.json').version;

export const angularCliVersion = '~15.1.0';
export const angularCliVersion = '~15.2.0';
export const typescriptVersion = '~4.9.5';
export const prettierVersion = '^2.6.2';
export const typescriptESLintVersion = '^5.36.1';
Expand Down
Loading

1 comment on commit 9efcf04

@vercel
Copy link

@vercel vercel bot commented on 9efcf04 Feb 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.