Skip to content

Commit

Permalink
build: fix build.sh for package group and add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
hansl committed Mar 8, 2018
1 parent 8ad4ae0 commit 21f2a6b
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ NODE_PACKAGES=(compiler-cli
benchpress)

SCOPED_PACKAGES=$(
for P in ${PACKAGES[@]}; do echo @angular/${P}; done
for P in ${PACKAGES[@]}; do echo \\@angular/${P}; done
)
NG_UPDATE_PACKAGE_GROUP=$(
# The first sed creates an array of strings
Expand Down
42 changes: 42 additions & 0 deletions integration/ng_update/check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const fs = require('fs');
const path = require('path');

const angularRoot = path.resolve('./node_modules/@angular');
const angularModules = fs.readdirSync(angularRoot).map(function (name) {
const content = fs.readFileSync(path.join(angularRoot, name, 'package.json'), 'utf-8').toString();
return JSON.parse(content);
}).reduce(function (acc, packageJson) {
acc[packageJson.name] = packageJson;
return acc;
}, Object.create(null));

var error = false;
Object.keys(angularModules).forEach(function (name) {
packageJson = angularModules[name];

const ngUpdate = packageJson['ng-update'];
if (!ngUpdate) {
console.error('Package ' + JSON.stringify(name) + ' does not have an "ng-update" key.');
error = true;
return;
}

const packageGroup = ngUpdate['packageGroup'];
if (!packageGroup) {
console.error('Package ' + JSON.stringify(name) + ' does not have a "packageGroup" key.');
error = true;
return;
}

// Verify that every packageGroup is represented in the list of modules.
Object.keys(angularModules).forEach(function (groupEntry) {
if (packageGroup.indexOf(groupEntry) == -1) {
console.error('Package ' + JSON.stringify(name) + ' is missing ' + JSON.stringify(groupEntry)
+ ' as a packageGroup entry.');
error = true;
return;
}
});
});

process.exit(error ? 1 : 0);
30 changes: 30 additions & 0 deletions integration/ng_update/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "ng_update",
"version": "0.0.0",
"scripts": {
"build": "",
"test": "node ./check.js"
},
"license": "MIT",
"dependencies": {
"@angular/animations": "file:../../dist/packages-dist/animations",
"@angular/common": "file:../../dist/packages-dist/common",
"@angular/compiler": "file:../../dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/core": "file:../../dist/packages-dist/core",
"@angular/forms": "file:../../dist/packages-dist/forms",
"@angular/http": "file:../../dist/packages-dist/http",
"@angular/language-service": "file:../../dist/packages-dist/language-service",
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
"@angular/platform-webworker": "file:../../dist/packages-dist/platform-webworker",
"@angular/platform-webworker-dynamic": "file:../../dist/packages-dist/platform-webworker-dynamic",
"@angular/router": "file:../../dist/packages-dist/router",
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
"rxjs": "file:../../node_modules/rxjs",
"typescript": "file:../../node_modules/typescript",
"zone.js": "file:../../node_modules/zone.js"
}
}

0 comments on commit 21f2a6b

Please sign in to comment.