Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix build.sh for package group and add a test #22638

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sh
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
@@ -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
@@ -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"
}
}