Skip to content

Commit

Permalink
feat(nx): add angular migrations for v8 (#1335)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored May 13, 2019
1 parent 9f27459 commit 109b203
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion packages/schematics/migrations/update-8-0-0/update-8-0-0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {
Rule,
chain,
SchematicContext,
Tree
Tree,
externalSchematic,
noop
} from '@angular-devkit/schematics';
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
import {
Expand Down Expand Up @@ -260,9 +262,50 @@ const updateDefaultCollection = (host: Tree) => {
});
};

export const runAngularMigrations: Rule = (
host: Tree,
context: SchematicContext
) => {
const packageJson = readJsonInTree(host, 'package.json');

return !!packageJson.dependencies['@angular/core']
? chain([
externalSchematic(
'@schematics/update',
'update',
{
packages: ['@angular/cli'],
from: '7.2.2',
to: '8.0.0-rc.3',
force: true,
next: true
},
{
interactive: true
}
),
externalSchematic(
'@schematics/update',
'update',
{
packages: ['@angular/core'],
from: '7.0.0',
to: '8.0.0-rc.3',
force: true,
next: true
},
{
interactive: true
}
)
])
: noop();
};

export default function(): Rule {
return chain([
displayInformation,
runAngularMigrations,
removeOldDependencies,
updateUpdateScript,
updateBuilders,
Expand Down

0 comments on commit 109b203

Please sign in to comment.