build: consolidate tsc to ease migration to @types/ based typings delivery

I actually tried to use @types/* directly but came across several issues which prevented me
from switching over:
- https://github.com/Microsoft/TypeScript/issues/8715
- https://github.com/Microsoft/TypeScript/issues/8723
This commit is contained in:
Igor Minar 2016-05-20 16:06:52 -07:00
parent b4a467e387
commit 16dfe3c63f
46 changed files with 56 additions and 200 deletions

View File

@ -107,11 +107,10 @@ do
$(npm bin)/tsc \
--out ${UMD_ES5_PATH} \
--target es5 \
--lib "es6,dom" \
--allowJs \
${UMD_ES6_PATH} \
modules/\@angular/manual_typings/globals.d.ts \
modules/\@angular/typings/es6-collections/es6-collections.d.ts \
modules/\@angular/typings/es6-promise/es6-promise.d.ts
${UMD_ES6_PATH}
rm ${UMD_ES6_PATH}
cat ./modules/@angular/license-banner.txt > ${UMD_ES5_PATH}.tmp

View File

@ -325,7 +325,7 @@ gulp.task('enforce-format', function() {
});
});
gulp.task('lint', ['build.tools'], function() {
gulp.task('lint', function() {
var tslint = require('gulp-tslint');
// Built-in rules are at
// https://github.com/palantir/tslint#supported-rules

View File

@ -17,15 +17,12 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"testing.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../manual_typings/globals.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -24,6 +24,5 @@
"index.ts",
"testing.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -18,15 +18,12 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"testing.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../manual_typings/globals.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -1,2 +1,2 @@
/// <reference path="../../typings/node/node.d.ts" />
/// <reference path="../../typings/jasmine/jasmine.d.ts" />
/// <reference path="../../../../typings/node/node.d.ts" />
/// <reference path="../../../../typings/jasmine/jasmine.d.ts" />

View File

@ -27,8 +27,8 @@
"files": [
"index.ts",
"src/main.ts",
"../typings/node/node.d.ts",
"../typings/jasmine/jasmine.d.ts",
"../../../typings/node/node.d.ts",
"../../../typings/jasmine/jasmine.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -1,6 +0,0 @@
/// <reference path="../../typings/es6-collections/es6-collections.d.ts" />
/// <reference path="../../typings/es6-promise/es6-promise.d.ts" />
/// <reference path="../../manual_typings/globals.d.ts" />
/// <reference path="../../typings/hammerjs/hammerjs.d.ts" />
/// <reference path="../../typings/jasmine/jasmine.d.ts" />
/// <reference path="../../../../node_modules/zone.js/dist/zone.js.d.ts" />

View File

@ -17,15 +17,13 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"testing.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../typings/jasmine/jasmine.d.ts",
"../manual_typings/globals.d.ts",
"../../../typings/jasmine/jasmine.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -17,14 +17,12 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"testing.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../manual_typings/globals.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -1,52 +0,0 @@
/**
* Subset of es6-shim typings.
* Angular should not require use of ES6 runtime but some API usages are already present.
* See https://github.com/angular/angular/issues/5242
* TODO(alexeagle): remove methods below which may not be present in targeted browser
*/
declare type PromiseConstructor = typeof Promise;
interface String {
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* position. Otherwise returns false.
*/
startsWith(searchString: string, position?: number): boolean;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* endPosition length(this). Otherwise returns false.
*/
endsWith(searchString: string, endPosition?: number): boolean;
}
interface Array<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: T, start?: number, end?: number): T[];
}
interface NumberConstructor {
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: number): boolean;
}

View File

@ -28,9 +28,9 @@
"files": [
"index.ts",
"testing.ts",
"../typings/jasmine/jasmine.d.ts",
"../typings/hammerjs/hammerjs.d.ts",
"../typings/angular-protractor/angular-protractor.d.ts",
"../../../typings/jasmine/jasmine.d.ts",
"../../../typings/hammerjs/hammerjs.d.ts",
"../../../typings/angular-protractor/angular-protractor.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -23,17 +23,15 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"testing.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../manual_typings/globals.d.ts",
"../typings/hammerjs/hammerjs.d.ts",
"../typings/angular-protractor/angular-protractor.d.ts",
"../typings/jasmine/jasmine.d.ts",
"../../../typings/hammerjs/hammerjs.d.ts",
"../../../typings/angular-protractor/angular-protractor.d.ts",
"../../../typings/jasmine/jasmine.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -24,7 +24,7 @@
},
"files": [
"index.ts",
"../typings/node/node.d.ts",
"../../../typings/node/node.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -20,14 +20,12 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../typings/node/node.d.ts",
"../manual_typings/globals.d.ts",
"../../../typings/node/node.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -19,14 +19,12 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"testing.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../manual_typings/globals.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -20,14 +20,12 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"testing.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../manual_typings/globals.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -1,8 +0,0 @@
/// <reference path="./typings/angular-protractor/angular-protractor.d.ts" />
/// <reference path="./typings/es6-collections/es6-collections.d.ts" />
/// <reference path="./typings/es6-promise/es6-promise.d.ts" />
/// <reference path="./typings/node/node.d.ts" />
/// <reference path="./manual_typings/globals.d.ts" />
/// <reference path="./typings/hammerjs/hammerjs.d.ts" />
/// <reference path="./typings/jasmine/jasmine.d.ts" />
/// <reference path="../../node_modules/zone.js/dist/zone.js.d.ts" />

View File

@ -20,13 +20,11 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"index.ts",
"../typings/es6-collections/es6-collections.d.ts",
"../typings/es6-promise/es6-promise.d.ts",
"../manual_typings/globals.d.ts",
"../../../node_modules/zone.js/dist/zone.js.d.ts"
]
}

View File

@ -1,12 +0,0 @@
{
"version": "v4",
"repo": "DefinitelyTyped/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"angularjs/angular.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
}
}
}

View File

@ -18,6 +18,7 @@
},
"rootDir": ".",
"inlineSourceMap": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"exclude": [

8
modules/types.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
// This file contains all ambient imports needed to compile the modules/ source code
/// <reference path="../typings/hammerjs/hammerjs.d.ts" />
/// <reference path="../typings/jasmine/jasmine.d.ts" />
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/selenium-webdriver/selenium-webdriver.d.ts" />
/// <reference path="../typings/angular-protractor/angular-protractor.d.ts" />
/// <reference path="../node_modules/zone.js/dist/zone.js.d.ts" />

View File

@ -61,9 +61,7 @@ if [[ ${TRAVIS} ]]; then
echo ${TSDRC} > ~/.tsdrc
fi
$(npm bin)/tsd reinstall --overwrite --clean --config modules/@angular/tsd.json
$(npm bin)/tsd reinstall --overwrite --clean --config tools/tsd.json
$(npm bin)/tsd reinstall --overwrite --config modules/angular1_router/tsd.json
$(npm bin)/tsd reinstall --overwrite --clean --config ./tsd.json
echo 'travis_fold:end:install.typings'

View File

@ -1,5 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/fs-extra/fs-extra.d.ts" />
import fse = require('fs-extra');
import path = require('path');
import {wrapDiffingPlugin, DiffingBroccoliPlugin, DiffResult} from './diffing-broccoli-plugin';
@ -62,8 +60,9 @@ class DartFormatter implements DiffingBroccoliPlugin {
}
let execute = (args: string[]) => {
if (args.length < 2) return Promise.resolve();
return new Promise((resolve, reject) => {
if (args.length < 2)
return Promise.resolve();
return new Promise<void>((resolve, reject) => {
exec(this.DARTFMT + ' ' + args.join(' '), (err: Error, stdout: string, stderr: string) => {
if (this.verbose) {
console.log(stdout);

View File

@ -1,6 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/fs-extra/fs-extra.d.ts" />
import fs = require('fs');
import fse = require('fs-extra');
import path = require('path');

View File

@ -1,5 +1,3 @@
/// <reference path="../typings/es6-promise/es6-promise.d.ts" />
interface FilterOptions {
extensions?: string[]
}

View File

@ -1,6 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/jasmine/jasmine.d.ts" />
let mockfs = require('mock-fs');
import fs = require('fs');
import path = require('path');

View File

@ -1,6 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/jasmine/jasmine.d.ts" />
let mockfs = require('mock-fs');
import fs = require('fs');
import {TreeDiffer, DiffResult} from './tree-differ';

View File

@ -1,6 +1,3 @@
/// <reference path="broccoli.d.ts" />
/// <reference path="../typings/node/node.d.ts" />
import fs = require('fs');
let symlinkOrCopy = require('symlink-or-copy');

View File

@ -1,6 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/fs-extra/fs-extra.d.ts" />
import fs = require('fs');
import fse = require('fs-extra');
import path = require('path');

View File

@ -1,5 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
import fs = require('fs');
import fse = require('fs-extra');
import path = require('path');

View File

@ -1,5 +1,3 @@
/// <reference path="../typings/es6-promise/es6-promise.d.ts" />
declare module "broccoli-writer" {
class Writer {
write(readTree: (tree: BroccoliTree) => Promise<string>, destDir: string): Promise<any>;

View File

@ -1,6 +1,3 @@
/// <reference path="../typings/es6-promise/es6-promise.d.ts" />
interface BroccoliTree {
/**
* Contains the fs path for the input tree when the plugin takes only one input tree.

View File

@ -1,6 +1,4 @@
/// <reference path="broccoli.d.ts" />
/// <reference path="../typings/fs-extra/fs-extra.d.ts" />
/// <reference path="../typings/node/node.d.ts" />
import fs = require('fs');
import fse = require('fs-extra');

View File

@ -1,5 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/fs-extra/fs-extra.d.ts" />
/// <reference path="./broccoli-writer.d.ts" />
import Writer = require('broccoli-writer');

View File

@ -1,6 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/jasmine/jasmine.d.ts" />
let mockfs = require('mock-fs');
import fs = require('fs');
import path = require('path');

View File

@ -1,5 +1,3 @@
/// <reference path="../typings/node/node.d.ts" />
import fs = require('fs');
import path = require('path');

View File

@ -1,4 +1,3 @@
/// <reference path="../../typings/node/node.d.ts" />
'use strict';
import {MultiCopy} from './../multi_copy';

View File

@ -15,12 +15,11 @@
"rootDir": "../../dist/all/@angular",
"sourceMap": true,
"sourceRoot": ".",
"lib": ["es6", "dom"],
"target": "es5"
},
"files": [
"../../modules/@angular/typings/es6-collections/es6-collections.d.ts",
"../../modules/@angular/typings/es6-promise/es6-promise.d.ts",
"../../modules/@angular/typings/node/node.d.ts",
"../../typings/node/node.d.ts",
"../../dist/all/@angular/compiler/test/output/output_emitter_codegen_typed.ts",
"../../dist/all/@angular/compiler/test/output/output_emitter_codegen_untyped.ts",
"../../dist/all/@angular/compiler/test/offline_compiler_codegen_untyped.ts",

View File

@ -50,8 +50,8 @@ export class TscWatch {
this.onStartCmds.forEach((cmd) => this.runCmd(cmd, null, () => null, () => null));
}
private runCmd(argsOrCmd: string[] | Command, env?: {[k: string]: string},
stdOut = pipeStdOut, stdErr = pipeStdErr): Promise<number>
private runCmd(argsOrCmd: string[] | Command, env?: {[k: string]: string},
stdOut = pipeStdOut, stdErr = pipeStdErr): Promise<number>
{
if (typeof argsOrCmd == 'function') {
return (argsOrCmd as Command)(stdErr, stdOut);
@ -117,7 +117,7 @@ export class TscWatch {
}
triggerCmds() {
var cmdPromise: Promise<number> = Promise.resolve();
var cmdPromise: Promise<number> = Promise.resolve(0);
this.onChangeCmds.forEach((cmd: string[] | Command) => {cmdPromise = cmdPromise.then(() => {
return this.runCmd(<string[]>cmd);
})});

View File

@ -13,6 +13,7 @@
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"lib": ["es6", "dom"],
"target": "es5"
},
"exclude": [

View File

@ -1,21 +0,0 @@
{
"version": "v4",
"repo": "DefinitelyTyped/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"fs-extra/fs-extra.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"node/node.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"es6-promise/es6-promise.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"jasmine/jasmine.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
}
}
}

5
tools/types.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
// This file contains all ambient imports needed to compile the tools source code
/// <reference path="../typings/jasmine/jasmine.d.ts" />
/// <reference path="../typings/node/node.d.ts" />
/// <reference path="../typings/fs-extra/fs-extra.d.ts" />

View File

@ -5,19 +5,16 @@
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"es6-promise/es6-promise.d.ts": {
"fs-extra/fs-extra.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"es6-collections/es6-collections.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"hammerjs/hammerjs.d.ts": {
"node/node.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"jasmine/jasmine.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"node/node.d.ts": {
"hammerjs/hammerjs.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"selenium-webdriver/selenium-webdriver.d.ts": {
@ -25,6 +22,9 @@
},
"angular-protractor/angular-protractor.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"angularjs/angular.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
}
}
}