-
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(nx): add migration to update Angular CLI devDependencies to 8.1.x
Angular CLI 8.1.x is required in order to use the --allow-dirty option. This also covers the additional build dependencies added when generating libraries.
- Loading branch information
1 parent
16a4e8d
commit 4f7ec84
Showing
20 changed files
with
664 additions
and
292 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
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
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
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
File renamed without changes.
69 changes: 69 additions & 0 deletions
69
packages/workspace/src/migrations/update-8-3-0/update-8-3-0.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,69 @@ | ||
import { Tree } from '@angular-devkit/schematics'; | ||
import { readJsonInTree } from '@nrwl/workspace'; | ||
import { | ||
SchematicTestRunner, | ||
UnitTestTree | ||
} from '@angular-devkit/schematics/testing'; | ||
import { serializeJson } from '@nrwl/workspace'; | ||
import { join } from 'path'; | ||
|
||
describe('Update 8.3.0', () => { | ||
let tree: Tree; | ||
let schematicRunner: SchematicTestRunner; | ||
|
||
beforeEach(() => { | ||
tree = new UnitTestTree(Tree.empty()); | ||
|
||
tree.create( | ||
'package.json', | ||
serializeJson({ | ||
devDependencies: { | ||
'@angular/cli': '8.0.0', | ||
'@angular-devkit/build-angular': '^0.800.0', | ||
'@angular-devkit/build-ng-packagr': '~0.800.0' | ||
} | ||
}) | ||
); | ||
|
||
schematicRunner = new SchematicTestRunner( | ||
'@nrwl/workspace', | ||
join(__dirname, '../../../migrations.json') | ||
); | ||
}); | ||
|
||
describe('Update Angular CLI', () => { | ||
it('should update @angular/cli', async () => { | ||
const result = await schematicRunner | ||
.runSchematicAsync('update-angular-cli-8-1', {}, tree) | ||
.toPromise(); | ||
|
||
expect( | ||
readJsonInTree(result, 'package.json').devDependencies['@angular/cli'] | ||
).toEqual('8.1.1'); | ||
}); | ||
|
||
it('should update @angular-devkit/build-angular', async () => { | ||
const result = await schematicRunner | ||
.runSchematicAsync('update-angular-cli-8-1', {}, tree) | ||
.toPromise(); | ||
|
||
expect( | ||
readJsonInTree(result, 'package.json').devDependencies[ | ||
'@angular-devkit/build-angular' | ||
] | ||
).toEqual('^0.801.1'); | ||
}); | ||
|
||
it('should update @angular-devkit/build-ng-packagr', async () => { | ||
const result = await schematicRunner | ||
.runSchematicAsync('update-angular-cli-8-1', {}, tree) | ||
.toPromise(); | ||
|
||
expect( | ||
readJsonInTree(result, 'package.json').devDependencies[ | ||
'@angular-devkit/build-ng-packagr' | ||
] | ||
).toEqual('~0.801.1'); | ||
}); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
packages/workspace/src/migrations/update-8-3-0/update-ng-cli-8-1.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,39 @@ | ||
import { updateJsonInTree } from '@nrwl/workspace'; | ||
import { chain, SchematicContext } from '@angular-devkit/schematics'; | ||
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; | ||
|
||
const updateCLI = updateJsonInTree('package.json', json => { | ||
json.devDependencies = json.devDependencies || {}; | ||
const cliVersion = json.devDependencies['@angular/cli']; | ||
|
||
if ( | ||
cliVersion && | ||
(cliVersion.startsWith('8.1') || | ||
cliVersion.startsWith('~8.1') || | ||
cliVersion.startsWith('^8.1')) | ||
) { | ||
return json; | ||
} | ||
|
||
if (json['devDependencies']['@angular/cli']) { | ||
json['devDependencies']['@angular/cli'] = '8.1.1'; | ||
} | ||
|
||
if (json['devDependencies']['@angular-devkit/build-angular']) { | ||
json['devDependencies']['@angular-devkit/build-angular'] = '^0.801.1'; | ||
} | ||
|
||
if (json['devDependencies']['@angular-devkit/build-ng-packagr']) { | ||
json['devDependencies']['@angular-devkit/build-ng-packagr'] = '~0.801.1'; | ||
} | ||
|
||
return json; | ||
}); | ||
|
||
const addInstall = (_: any, context: SchematicContext) => { | ||
context.addTask(new NodePackageInstallTask()); | ||
}; | ||
|
||
export default function() { | ||
return chain([updateCLI, addInstall]); | ||
} |
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,5 +1,5 @@ | ||
export const nxVersion = '*'; | ||
|
||
export const angularCliVersion = '8.0.0'; | ||
export const angularCliVersion = '8.1.1'; | ||
export const typescriptVersion = '~3.4.5'; | ||
export const prettierVersion = '1.16.4'; |
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.