-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(angular): support angular v16.1
- Loading branch information
1 parent
1fda800
commit 8febf46
Showing
19 changed files
with
3,411 additions
and
1,307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/angular/src/migrations/update-16-4-0/update-angular-cli.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
packages/angular/src/migrations/update-16-4-0/update-angular-cli.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const typescriptVersion = '~5.0.2'; | ||
export const typescriptVersion = '~5.1.3'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const typescriptVersion = '~5.0.2'; | ||
export const typescriptVersion = '~5.1.3'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
Oops, something went wrong.