-
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 v19.0.0-rc.3 (#28953)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> <!-- This is the behavior we have today --> <!-- This is the behavior we should expect with the changes in this PR --> <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
- Loading branch information
1 parent
429ea42
commit 9b3f3ad
Showing
9 changed files
with
3,066 additions
and
1,344 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
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-20-2-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-20-2-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 = '~19.0.0-rc.3'; | ||
|
||
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
Oops, something went wrong.