build(npm): upgrade to npm v3

Closes #3193
This commit is contained in:
Brian Ford 2015-12-21 14:50:56 -08:00 committed by Igor Minar
parent 47a3b4d56b
commit 6cfc6f5bb2
12 changed files with 5162 additions and 5122 deletions

View File

@ -60,6 +60,7 @@ addons:
firefox: "38.0" firefox: "38.0"
before_install: before_install:
- npm install -g npm@3.5.2
- node tools/analytics/build-analytics start ci job - node tools/analytics/build-analytics start ci job
- node tools/analytics/build-analytics start ci before_install - node tools/analytics/build-analytics start ci before_install
- echo ${TSDRC} > .tsdrc - echo ${TSDRC} > .tsdrc
@ -77,7 +78,9 @@ install:
# Check the size of caches # Check the size of caches
- du -sh ./node_modules || true - du -sh ./node_modules || true
# Install npm dependecies # Install npm dependecies
- npm install # check-node-modules will exit(1) if we don't need to install
# we need to manually kick off the postinstall script if check-node-modules exit(0)s
- node tools/npm/check-node-modules --purge && npm install || npm run postinstall
- node tools/analytics/build-analytics success ci install - node tools/analytics/build-analytics success ci install
before_script: before_script:

View File

@ -3,7 +3,7 @@
// THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE // THIS CHECK SHOULD BE THE FIRST THING IN THIS FILE
// This is to ensure that we catch env issues before we error while requiring other dependencies. // This is to ensure that we catch env issues before we error while requiring other dependencies.
require('./tools/check-environment')( require('./tools/check-environment')(
{requiredNpmVersion: '>=2.14.7 <3.0.0', requiredNodeVersion: '>=4.2.1 <5.0.0'}); {requiredNpmVersion: '>=3.5.2 <4.0.0', requiredNodeVersion: '>=4.2.1 <5.0.0'});
var del = require('del'); var del = require('del');
@ -327,7 +327,9 @@ gulp.task('lint', ['build.tools'], function() {
"requireParameterType": true, "requireParameterType": true,
"requireReturnType": true, "requireReturnType": true,
"semicolon": true, "semicolon": true,
"variable-name": [true, "ban-keywords"]
// TODO: find a way to just screen for reserved names
"variable-name": false
} }
}; };
return gulp.src(['modules/angular2/src/**/*.ts', '!modules/angular2/src/testing/**']) return gulp.src(['modules/angular2/src/**/*.ts', '!modules/angular2/src/testing/**'])

File diff suppressed because it is too large Load Diff

6286
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,8 +26,8 @@
"url": "https://github.com/angular/angular.git" "url": "https://github.com/angular/angular.git"
}, },
"scripts": { "scripts": {
"preinstall": "node tools/analytics/build-analytics start install npm-install && node tools/analytics/build-analytics start install npm-preinstall && node tools/npm/check-node-modules --purge && node tools/analytics/build-analytics success install npm-preinstall && node tools/analytics/build-analytics start install npm-install-net", "preinstall": "node tools/analytics/build-analytics start install npm3-install && node tools/analytics/build-analytics start install npm-preinstall && node tools/npm/check-node-modules && node tools/analytics/build-analytics success install npm-preinstall && node tools/analytics/build-analytics start install npm-install-net",
"postinstall": "node tools/analytics/build-analytics success install npm-install-net && node tools/analytics/build-analytics start install npm-postinstall && node tools/npm/copy-npm-shrinkwrap && node tools/chromedriverpatch.js && webdriver-manager update && bower install && gulp pubget.dart && tsd reinstall --overwrite --clean --config modules/angular2/tsd.json && tsd reinstall --overwrite --clean --config tools/tsd.json && tsd reinstall --overwrite --config modules/angular1_router/tsd.json && node tools/analytics/build-analytics success install npm-postinstall && node tools/analytics/build-analytics success install npm-install", "postinstall": "node tools/analytics/build-analytics success install npm-install-net && node tools/analytics/build-analytics start install npm-postinstall && node tools/npm/copy-npm-shrinkwrap && node tools/chromedriverpatch.js && webdriver-manager update && bower install && gulp pubget.dart && tsd reinstall --overwrite --clean --config modules/angular2/tsd.json && tsd reinstall --overwrite --clean --config tools/tsd.json && tsd reinstall --overwrite --config modules/angular1_router/tsd.json && node tools/analytics/build-analytics success install npm-postinstall && node tools/analytics/build-analytics success install npm3-install",
"build": "gulp build.js", "build": "gulp build.js",
"test": "gulp test.all.js && gulp test.all.dart" "test": "gulp test.all.js && gulp test.all.dart"
}, },
@ -115,7 +115,7 @@
"through2": "^0.6.5", "through2": "^0.6.5",
"ts2dart": "^0.7.19", "ts2dart": "^0.7.19",
"tsd": "^0.6.5-beta", "tsd": "^0.6.5-beta",
"tslint": "^3.0.0-dev.1", "tslint": "^3.2.1",
"typescript": "^1.7.3", "typescript": "^1.7.3",
"universal-analytics": "^0.3.9", "universal-analytics": "^0.3.9",
"webpack": "^1.12.6", "webpack": "^1.12.6",

View File

@ -40,9 +40,13 @@ switch (eventType) {
fs.writeFileSync(startTimestampFilePath, Date.now(), 'utf-8'); fs.writeFileSync(startTimestampFilePath, Date.now(), 'utf-8');
break; break;
case 'success': case 'success':
var startTime = fs.readFileSync(startTimestampFilePath, 'utf-8'); try {
analytics[actionCategory + 'Success'](actionName, Date.now() - startTime); var startTime = fs.readFileSync(startTimestampFilePath, 'utf-8');
fs.unlinkSync(startTimestampFilePath); analytics[actionCategory + 'Success'](actionName, Date.now() - startTime);
fs.unlinkSync(startTimestampFilePath);
} catch(e) {
console.log('No start timestamp file "' + startTimestampFilePath + '" found, skipping analytics.');
}
break; break;
case 'error': case 'error':
var startTime = fs.readFileSync(startTimestampFilePath, 'utf-8'); var startTime = fs.readFileSync(startTimestampFilePath, 'utf-8');

View File

@ -2,6 +2,9 @@
var checkNpm = require('./check-node-modules.js'); var checkNpm = require('./check-node-modules.js');
var purgeIfStale = (process.argv.indexOf('--purge') !== -1) var purgeIfStale = (process.argv.indexOf('--purge') !== -1);
// check-node-modules will exit(1) if we don't need to install to short-circuit `npm install`
// see .travis.yml's `install` block to see the reason for this
process.exit(checkNpm(true, purgeIfStale) ? 1 : 0);
checkNpm(true, purgeIfStale);

View File

@ -4,7 +4,7 @@ var fs = require('fs');
var path = require('path'); var path = require('path');
var NPM_SHRINKWRAP_FILE = 'npm-shrinkwrap.json'; var NPM_SHRINKWRAP_FILE = 'npm-shrinkwrap.json';
var NPM_SHRINKWRAP_CACHED_FILE = 'node_modules/npm-shrinkwrap.cached.json'; var NPM_SHRINKWRAP_CACHED_FILE = 'node_modules/.npm-shrinkwrap.cached.json';
var FS_OPTS = {encoding: 'utf-8'}; var FS_OPTS = {encoding: 'utf-8'};
var PROJECT_ROOT = path.join(__dirname, '../../'); var PROJECT_ROOT = path.join(__dirname, '../../');

View File

@ -4,7 +4,7 @@ var fse = require('fs-extra');
var path = require('path'); var path = require('path');
var NPM_SHRINKWRAP_FILE = 'npm-shrinkwrap.json'; var NPM_SHRINKWRAP_FILE = 'npm-shrinkwrap.json';
var NPM_SHRINKWRAP_CACHED_FILE = 'node_modules/npm-shrinkwrap.cached.json'; var NPM_SHRINKWRAP_CACHED_FILE = 'node_modules/.npm-shrinkwrap.cached.json';
var PROJECT_ROOT = path.join(__dirname, '../../'); var PROJECT_ROOT = path.join(__dirname, '../../');
process.chdir(PROJECT_ROOT); process.chdir(PROJECT_ROOT);

View File

@ -1,7 +1,7 @@
import {RuleFailure} from 'tslint/lib/lint'; import {RuleFailure} from 'tslint/lib/lint';
import {AbstractRule} from 'tslint/lib/rules'; import {AbstractRule} from 'tslint/lib/rules';
import {RuleWalker} from 'tslint/lib/language/walker'; import {RuleWalker} from 'tslint/lib/language/walker';
import * as ts from 'tslint/node_modules/typescript'; import * as ts from 'typescript';
export class Rule extends AbstractRule { export class Rule extends AbstractRule {
public apply(sourceFile: ts.SourceFile): RuleFailure[] { public apply(sourceFile: ts.SourceFile): RuleFailure[] {

View File

@ -1,7 +1,7 @@
import {RuleFailure} from 'tslint/lib/lint'; import {RuleFailure} from 'tslint/lib/lint';
import {AbstractRule} from 'tslint/lib/rules'; import {AbstractRule} from 'tslint/lib/rules';
import {RuleWalker} from 'tslint/lib/language/walker'; import {RuleWalker} from 'tslint/lib/language/walker';
import * as ts from 'tslint/node_modules/typescript'; import * as ts from 'typescript';
export class Rule extends AbstractRule { export class Rule extends AbstractRule {
public static FAILURE_STRING = "missing type declaration"; public static FAILURE_STRING = "missing type declaration";

View File

@ -1,7 +1,7 @@
import {RuleFailure} from 'tslint/lib/lint'; import {RuleFailure} from 'tslint/lib/lint';
import {AbstractRule} from 'tslint/lib/rules'; import {AbstractRule} from 'tslint/lib/rules';
import {RuleWalker} from 'tslint/lib/language/walker'; import {RuleWalker} from 'tslint/lib/language/walker';
import * as ts from 'tslint/node_modules/typescript'; import * as ts from 'typescript';
export class Rule extends AbstractRule { export class Rule extends AbstractRule {
public static FAILURE_STRING = "missing type declaration"; public static FAILURE_STRING = "missing type declaration";