Skip to content

Commit 024d6bd

Browse files
committed
fix(@angular/cli): add packageGroup for @angular/cli
This should add ng-update support to updating ALL the packages that are published from this repo. Fixes #13581
1 parent cdda1c3 commit 024d6bd

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

packages/angular/cli/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
"symbol-observable": "1.2.0"
4242
},
4343
"ng-update": {
44-
"migrations": "@schematics/angular/migrations/migration-collection.json"
44+
"migrations": "@schematics/angular/migrations/migration-collection.json",
45+
"packageGroup": {
46+
"@angular/cli": "0.0.0"
47+
}
4548
}
4649
}

scripts/build.ts

+25
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,31 @@ export default async function(
393393
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
394394
}
395395

396+
logger.info('Setting packageGroups...');
397+
for (const packageName of sortedPackages) {
398+
versionLogger.info(packageName);
399+
const pkg = packages[packageName];
400+
if (pkg.private) {
401+
continue;
402+
}
403+
404+
const packageJsonPath = path.join(pkg.dist, 'package.json');
405+
const packageJson = pkg.packageJson;
406+
// tslint:disable-next-line:no-any
407+
const ngUpdateJson: any = packageJson['ng-update'] || (packageJson['ng-update'] = {});
408+
const packageGroup = ngUpdateJson['packageGroup'] || (ngUpdateJson['packageGroup'] = {}) as JsonObject;
409+
410+
for (const subPackageName of sortedPackages) {
411+
const subpkg = packages[subPackageName];
412+
if (subpkg.private) {
413+
continue;
414+
}
415+
packageGroup[subPackageName] = subpkg.version;
416+
}
417+
418+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n');
419+
}
420+
396421
logger.info('Tarring all packages...');
397422
const tarLogger = logger.createChild('license');
398423
Object.keys(packages).forEach(pkgName => {

0 commit comments

Comments
 (0)