Skip to content

Commit

Permalink
feat(angular): support angular v16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez committed Jun 19, 2023
1 parent 1fda800 commit 8febf46
Show file tree
Hide file tree
Showing 19 changed files with 3,411 additions and 1,307 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@
},
"devDependencies": {
"@actions/core": "^1.10.0",
"@angular-devkit/architect": "~0.1600.0",
"@angular-devkit/build-angular": "~16.0.0",
"@angular-devkit/core": "~16.0.0",
"@angular-devkit/schematics": "~16.0.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-eslint/eslint-plugin": "~16.0.0",
"@angular-eslint/eslint-plugin-template": "~16.0.0",
"@angular-eslint/template-parser": "~16.0.0",
"@angular/cli": "~16.0.0",
"@angular/common": "~16.0.0",
"@angular/compiler": "~16.0.0",
"@angular/compiler-cli": "~16.0.0",
"@angular/core": "~16.0.0",
"@angular/router": "~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",
"@babel/core": "^7.15.0",
"@babel/helper-create-regexp-features-plugin": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.15.0",
Expand All @@ -63,7 +63,7 @@
"@ngrx/effects": "~16.0.0",
"@ngrx/router-store": "~16.0.0",
"@ngrx/store": "~16.0.0",
"@nguniversal/builders": "~16.0.0",
"@nguniversal/builders": "~16.1.0",
"@nx/cypress": "16.4.0-beta.9",
"@nx/devkit": "16.4.0-beta.9",
"@nx/eslint-plugin": "16.4.0-beta.9",
Expand All @@ -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.0.0",
"@schematics/angular": "~16.1.0",
"@storybook/addon-essentials": "^7.0.9",
"@storybook/core-server": "^7.0.9",
"@storybook/react": "^7.0.9",
Expand Down Expand Up @@ -208,7 +208,7 @@
"mini-css-extract-plugin": "~2.4.7",
"minimatch": "3.0.5",
"next-sitemap": "^3.1.10",
"ng-packagr": "~16.0.0",
"ng-packagr": "~16.1.0",
"node-fetch": "^2.6.7",
"nx": "16.4.0-beta.9",
"nx-cloud": "16.0.5",
Expand Down Expand Up @@ -259,9 +259,9 @@
"tsconfig-paths": "^4.1.2",
"tsconfig-paths-webpack-plugin": "4.0.0",
"tslint-to-eslint-config": "^2.13.0",
"typedoc": "0.23.28",
"typedoc-plugin-markdown": "3.14.0",
"typescript": "~5.0.2",
"typedoc": "0.24.8",
"typedoc-plugin-markdown": "3.15.3",
"typescript": "~5.1.3",
"unzipper": "^0.10.11",
"url-loader": "^4.1.1",
"use-sync-external-store": "^1.2.0",
Expand Down
70 changes: 70 additions & 0 deletions packages/angular/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,15 @@
},
"description": "Remove the 'accessibility-' prefix from '@angular-eslint/eslint-plugin-template' rules.",
"factory": "./src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules"
},
"update-angular-cli-version-16-1-0": {
"cli": "nx",
"version": "16.4.0-beta.8",
"requires": {
"@angular/core": ">=16.1.0"
},
"description": "Update the @angular/cli package version to ~16.1.0.",
"factory": "./src/migrations/update-16-4-0/update-angular-cli"
}
},
"packageJsonUpdates": {
Expand Down Expand Up @@ -1159,6 +1168,67 @@
"alwaysAddToPackageJson": false
}
}
},
"16.4.0": {
"version": "16.4.0-beta.8",
"x-prompt": "Do you want to update the Angular version to v16.1?",
"requires": {
"@angular/core": ">=16.0.0 <16.1.0"
},
"packages": {
"@angular-devkit/architect": {
"version": "~0.1601.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-angular": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/build-webpack": {
"version": "~0.1601.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/core": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@angular-devkit/schematics": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@angular/core": {
"version": "~16.1.0",
"alwaysAddToPackageJson": true
},
"@angular/material": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@angular/cdk": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/builders": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/common": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@nguniversal/express-engine": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"@schematics/angular": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
},
"ng-packagr": {
"version": "~16.1.0",
"alwaysAddToPackageJson": false
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { formatFiles, Tree, updateJson } from '@nx/devkit';

export const angularCliVersion = '~16.1.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,15 +1,15 @@
export const nxVersion = require('../../package.json').version;

export const angularVersion = '~16.0.0';
export const angularDevkitVersion = '~16.0.0';
export const ngPackagrVersion = '~16.0.0';
export const angularVersion = '~16.1.0';
export const angularDevkitVersion = '~16.1.0';
export const ngPackagrVersion = '~16.1.0';
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.0.0';
export const ngUniversalVersion = '~16.1.0';
export const corsVersion = '~2.8.5';
export const typesCorsVersion = '~2.8.5';
export const expressVersion = '~4.18.2';
Expand Down
2 changes: 1 addition & 1 deletion packages/devkit/src/utils/versions.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const typescriptVersion = '~5.0.2';
export const typescriptVersion = '~5.1.3';
12 changes: 12 additions & 0 deletions packages/js/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@
"version": "~5.0.2"
}
}
},
"16.4.0": {
"version": "16.4.0-beta.8",
"x-prompt": "Do you want to update to TypeScript v5.1?",
"requires": {
"typescript": ">=5.0.0 <5.1.0"
},
"packages": {
"typescript": {
"version": "~5.1.3"
}
}
}
}
}
2 changes: 1 addition & 1 deletion packages/js/src/utils/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const typesNodeVersion = '18.7.1';
export const verdaccioVersion = '^5.0.4';

// Typescript
export const typescriptVersion = '~5.0.2';
export const typescriptVersion = '~5.1.3';
/**
* The minimum version is currently determined from the lowest version
* that's supported by the lowest Angular supported version, e.g.
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/plugins/js/versions.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const typescriptVersion = '~5.0.2';
export const typescriptVersion = '~5.1.3';
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`@nx/storybook:init dependencies for package.json should add angular rel
"@storybook/core-server": "7.0.9",
"existing": "1.0.0",
"prettier": "^2.6.2",
"typescript": "~5.0.2",
"typescript": "~5.1.3",
},
"name": "test-name",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`@nx/vite:init dependencies for package.json should add vite packages an
"@vitest/ui": "^0.32.0",
"existing": "1.0.0",
"prettier": "^2.6.2",
"typescript": "~5.0.2",
"typescript": "~5.1.3",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.0",
Expand All @@ -30,7 +30,7 @@ exports[`@nx/vite:init dependencies for package.json should support --testEnviro
"@nx/vite": "0.0.1",
"@vitest/ui": "^0.32.0",
"prettier": "^2.6.2",
"typescript": "~5.0.2",
"typescript": "~5.1.3",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.0",
Expand All @@ -48,7 +48,7 @@ exports[`@nx/vite:init dependencies for package.json should support --testEnviro
"@vitest/ui": "^0.32.0",
"happy-dom": "~9.20.3",
"prettier": "^2.6.2",
"typescript": "~5.0.2",
"typescript": "~5.1.3",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.0",
Expand All @@ -66,7 +66,7 @@ exports[`@nx/vite:init dependencies for package.json should support --testEnviro
"@vitest/ui": "^0.32.0",
"jsdom": "~22.1.0",
"prettier": "^2.6.2",
"typescript": "~5.0.2",
"typescript": "~5.1.3",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/workspace/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@
"version": "~5.0.2"
}
}
},
"16.4.0": {
"version": "16.4.0-beta.8",
"x-prompt": "Do you want to update to TypeScript v5.1?",
"requires": {
"typescript": ">=5.0.0 <5.1.0"
},
"packages": {
"typescript": {
"version": "~5.1.3"
}
}
}
}
}
4 changes: 2 additions & 2 deletions packages/workspace/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 typescriptVersion = '~5.0.2';
export const typescriptVersion = '~5.1.3';
export const typescriptESLintVersion = '^5.58.0';
export const eslintVersion = '~8.15.0';
export const eslintConfigPrettierVersion = '8.1.0';

// TODO: remove when preset generation is reworked and
// deps are not installed from workspace
export const angularCliVersion = '~16.0.0';
export const angularCliVersion = '~16.1.0';
export const prettierVersion = '^2.6.2';
Loading

0 comments on commit 8febf46

Please sign in to comment.