refactor: add license header to JS files & format files (#12035)
This commit is contained in:

committed by
Chuck Jazdzewski

parent
b64b5ece65
commit
8310c91823
@ -1,3 +1,11 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!! !!!
|
||||
!!! This file is special in that it must be able to execute with wrong Node version !!!
|
||||
@ -16,28 +24,29 @@ var issues = [];
|
||||
|
||||
// coarse Node version check
|
||||
if (+process.version[1] < 5) {
|
||||
issues.push("Angular 2 build currently requires Node 5+. Use nvm to update your node version.");
|
||||
issues.push('Angular 2 build currently requires Node 5+. Use nvm to update your node version.');
|
||||
}
|
||||
|
||||
try {
|
||||
semver = require('semver');
|
||||
} catch(e) {
|
||||
issues.push("Looks like you are missing some npm dependencies. Run: npm install");
|
||||
} catch (e) {
|
||||
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
|
||||
}
|
||||
|
||||
if (issues.length) {
|
||||
printWarning(issues);
|
||||
console.error("Your environment doesn't provide the prerequisite dependencies.\n" +
|
||||
"Please fix the issues listed above and then rerun the gulp command.\n" +
|
||||
"Check out https://github.com/angular/angular/blob/master/DEVELOPER.md for more info.");
|
||||
console.error(
|
||||
'Your environment doesn\'t provide the prerequisite dependencies.\n' +
|
||||
'Please fix the issues listed above and then rerun the gulp command.\n' +
|
||||
'Check out https://github.com/angular/angular/blob/master/DEVELOPER.md for more info.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// wrap in try/catch in case someone requires from within that file
|
||||
try {
|
||||
checkNodeModules = require('./npm/check-node-modules.js');
|
||||
} catch(e) {
|
||||
issues.push("Looks like you are missing some npm dependencies. Run: npm install");
|
||||
} catch (e) {
|
||||
issues.push('Looks like you are missing some npm dependencies. Run: npm install');
|
||||
throw e;
|
||||
} finally {
|
||||
// print warnings and move on, the next steps will likely fail, but hey, we warned them.
|
||||
@ -45,7 +54,6 @@ try {
|
||||
}
|
||||
|
||||
function checkEnvironment(reqs) {
|
||||
|
||||
exec('npm --version', function(e, stdout) {
|
||||
var foundNpmVersion = semver.clean(stdout);
|
||||
var foundNodeVersion = process.version;
|
||||
@ -53,17 +61,20 @@ function checkEnvironment(reqs) {
|
||||
|
||||
|
||||
if (!semver.satisfies(foundNodeVersion, reqs.requiredNodeVersion)) {
|
||||
issues.push('You are running unsupported node version. Found: ' + foundNodeVersion +
|
||||
' Expected: ' + reqs.requiredNodeVersion + '. Use nvm to update your node version.');
|
||||
issues.push(
|
||||
'You are running unsupported node version. Found: ' + foundNodeVersion + ' Expected: ' +
|
||||
reqs.requiredNodeVersion + '. Use nvm to update your node version.');
|
||||
}
|
||||
|
||||
if (!semver.satisfies(foundNpmVersion, reqs.requiredNpmVersion)) {
|
||||
issues.push('You are running unsupported npm version. Found: ' + foundNpmVersion +
|
||||
' Expected: ' + reqs.requiredNpmVersion + '. Run: npm update -g npm');
|
||||
issues.push(
|
||||
'You are running unsupported npm version. Found: ' + foundNpmVersion + ' Expected: ' +
|
||||
reqs.requiredNpmVersion + '. Run: npm update -g npm');
|
||||
}
|
||||
|
||||
if (!checkNodeModules()) {
|
||||
issues.push('Your node_modules directory is stale or out of sync with npm-shrinkwrap.json. Run: npm install');
|
||||
issues.push(
|
||||
'Your node_modules directory is stale or out of sync with npm-shrinkwrap.json. Run: npm install');
|
||||
}
|
||||
|
||||
printWarning(issues);
|
||||
@ -76,7 +87,7 @@ function printWarning(issues) {
|
||||
console.warn('');
|
||||
console.warn('!'.repeat(110));
|
||||
console.warn('!!! Your environment is not in a good shape. Following issues were found:');
|
||||
issues.forEach(function(issue) {console.warn('!!! - ' + issue);});
|
||||
issues.forEach(function(issue) { console.warn('!!! - ' + issue); });
|
||||
console.warn('!'.repeat(110));
|
||||
console.warn('');
|
||||
|
||||
|
Reference in New Issue
Block a user