build: allow check-environment.js to be run directly

This commit is contained in:
Peter Bacon Darwin 2017-03-03 11:17:19 +00:00 committed by Igor Minar
parent ab0db66bf7
commit 00fdcf4e58
1 changed files with 11 additions and 0 deletions

View File

@ -53,6 +53,17 @@ try {
printWarning(issues);
}
if (require.main === module) {
// we are running this script directly so just run checkEnvironment against the main angular
// package.json
var engines = require(__dirname + '/../package.json').engines;
checkEnvironment({
requiredNodeVersion: engines.node,
requiredNpmVersion: engines.npm,
requiredYarnVersion: engines.yarn
});
}
function checkEnvironment(reqs) {
exec('npm --version', function(npmErr, npmStdout) {
exec('yarn --version', function(yarnErr, yarnStdout) {