Skip to content

Commit

Permalink
feat(@angular/cli): automatically update angular builders when CLI is…
Browse files Browse the repository at this point in the history
… updated

Closes #13581
  • Loading branch information
clydin authored and alexeagle committed Apr 8, 2019
1 parent 28498b6 commit 7b7d74e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 7 additions & 1 deletion packages/angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
"uuid": "^3.3.2"
},
"ng-update": {
"migrations": "@schematics/angular/migrations/migration-collection.json"
"migrations": "@schematics/angular/migrations/migration-collection.json",
"packageGroup": {
"@angular/cli": "0.0.0",
"@angular-devkit/build-angular": "0.0.0",
"@angular-devkit/build-ng-packagr": "0.0.0",
"@angular-devkit/build-webpack": "0.0.0"
}
}
}
16 changes: 13 additions & 3 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ async function _bazel(logger: logging.Logger) {
// _exec('bazel', ['build', '//packages/...'], {}, logger);
}

// tslint:disable-next-line:no-big-function
export default async function(
argv: { local?: boolean, snapshot?: boolean },
logger: logging.Logger,
Expand Down Expand Up @@ -367,9 +368,18 @@ export default async function(

for (const depName of Object.keys(packages)) {
const v = packages[depName].version;
for (const depKey of ['dependencies', 'peerDependencies', 'devDependencies']) {
const obj = packageJson[depKey] as JsonObject | null;
if (obj && obj[depName]) {
for (const depKey of ['dependencies', 'peerDependencies', 'devDependencies', 'ng-update']) {
let obj: JsonObject | null;
if (depKey === 'ng-update') {
const updateObject = packageJson[depKey] as JsonObject | null;
if (!updateObject) {
continue;
}
obj = updateObject['packageGroup'] as JsonObject | null;
} else {
obj = packageJson[depKey] as JsonObject | null;
}
if (obj && typeof obj === 'object' && obj[depName]) {
if (argv.local) {
obj[depName] = packages[depName].tar;
} else if (argv.snapshot) {
Expand Down

0 comments on commit 7b7d74e

Please sign in to comment.