Produce .d.ts files from our typescript compilation.
Deliver them into our npm module output so users can consume them directly. Fixes #3082
This commit is contained in:
44
gulpfile.js
44
gulpfile.js
@ -446,7 +446,7 @@ function runKarma(configFile, done) {
|
||||
|
||||
gulp.task('test.js', function(done) {
|
||||
runSequence('test.unit.tools/ci', 'test.transpiler.unittest', 'test.unit.js/ci',
|
||||
'test.unit.cjs/ci', 'test.typings', sequenceComplete(done));
|
||||
'test.unit.cjs/ci', 'test.typings', 'test.typings.npm', sequenceComplete(done));
|
||||
});
|
||||
|
||||
gulp.task('test.dart', function(done) {
|
||||
@ -771,8 +771,25 @@ gulp.task('!pre.test.typings', ['docs/typings'], function() {
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// Tests for the typings we deliver for TS users
|
||||
//
|
||||
// There are currently two mechanisms for this.
|
||||
// The first is the legacy, bundled .d.ts file produced by dgeni.
|
||||
// This is tested by 'test.typings'.
|
||||
//
|
||||
// The second is individual .d.ts files produced by the compiler,
|
||||
// distributed in our npm package, and loaded from node_modules by
|
||||
// the typescript compiler.
|
||||
// This is tested by 'test.typings.npm'.
|
||||
//
|
||||
// During the transition, we support both packaging/delivery types.
|
||||
// TODO(alexeagle): remove the dgeni bundle when users have switched
|
||||
|
||||
gulp.task('test.typings', ['!pre.test.typings'], function() {
|
||||
return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts', 'dist/docs/typings/http.d.ts'])
|
||||
return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts',
|
||||
'dist/docs/typings/http.d.ts',
|
||||
'dist/docs/typings/es6-shim/es6-shim.d.ts',
|
||||
'dist/docs/typings/jasmine/jasmine.d.ts'])
|
||||
.pipe(tsc({target: 'ES5', module: 'commonjs',
|
||||
experimentalDecorators: true,
|
||||
noImplicitAny: true,
|
||||
@ -781,6 +798,29 @@ gulp.task('test.typings', ['!pre.test.typings'], function() {
|
||||
typescript: require('typescript')}));
|
||||
});
|
||||
|
||||
// Make sure the two typings tests are isolated, by running this one in a tempdir
|
||||
var tmpdir = path.join(os.tmpdir(), 'test.typings', new Date().getTime().toString());
|
||||
gulp.task('!pre.test.typings.layoutNodeModule', function() {
|
||||
return gulp
|
||||
.src(['dist/js/dev/es5/angular2/**/*'], {base: 'dist/js/dev/es5'})
|
||||
.pipe(gulp.dest(path.join(tmpdir, 'node_modules')));
|
||||
});
|
||||
gulp.task('!pre.test.typings.copyTypingsSpec', function() {
|
||||
return gulp
|
||||
.src(['typing_spec/basic_spec.ts'], {base: 'typing_spec'})
|
||||
.pipe(gulp.dest(path.join(tmpdir)));
|
||||
});
|
||||
gulp.task('test.typings.npm', [
|
||||
'!pre.test.typings.layoutNodeModule',
|
||||
'!pre.test.typings.copyTypingsSpec'
|
||||
], function() {
|
||||
return gulp.src([tmpdir + '/**'])
|
||||
.pipe(tsc({target: 'ES5', module: 'commonjs',
|
||||
experimentalDecorators: true,
|
||||
noImplicitAny: true,
|
||||
typescript: require('typescript')}));
|
||||
});
|
||||
|
||||
// -----------------
|
||||
// orchestrated targets
|
||||
|
||||
|
Reference in New Issue
Block a user