chore(gulp): add typescript transpilation tasks

This commit is contained in:
Jeff Cross 2015-03-30 13:25:18 -07:00
parent e81e5fb2b9
commit 814d389b6e
1 changed files with 22 additions and 0 deletions

View File

@ -24,7 +24,9 @@ var karma = require('karma').server;
var minimist = require('minimist'); var minimist = require('minimist');
var es5build = require('./tools/build/es5build'); var es5build = require('./tools/build/es5build');
var runServerDartTests = require('./tools/build/run_server_dart_tests'); var runServerDartTests = require('./tools/build/run_server_dart_tests');
var sourcemaps = require('gulp-sourcemaps');
var transformCJSTests = require('./tools/build/transformCJSTests'); var transformCJSTests = require('./tools/build/transformCJSTests');
var tsc = require('gulp-typescript');
var ts2dart = require('gulp-ts2dart'); var ts2dart = require('gulp-ts2dart');
var util = require('./tools/build/util'); var util = require('./tools/build/util');
@ -120,6 +122,7 @@ var CONFIG = {
transpile: { transpile: {
src: { src: {
js: ['modules/**/*.js', 'modules/**/*.es6'], js: ['modules/**/*.js', 'modules/**/*.es6'],
ts: ['modules/**/*.ts'],
dart: ['modules/**/*.js'] dart: ['modules/**/*.js']
}, },
options: { options: {
@ -297,6 +300,25 @@ gulp.task('build/transpile.js.dev.es6', transpile(gulp, gulpPlugins, {
srcFolderInsertion: CONFIG.srcFolderInsertion.js srcFolderInsertion: CONFIG.srcFolderInsertion.js
})); }));
gulp.task('build/transpile.ts.dev.es5', function() {
var tsResult = gulp.src(CONFIG.transpile.src.ts)
.pipe(sourcemaps.init())
.pipe(tsc({
target: 'ES5',
module: 'commonjs',
typescript: require('typescript'),
noEmitOnError: true
}))
.js;
return merge([
tsResult.js.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(CONFIG.dest.js.dev.es5)),
tsResult.js.pipe(gulp.dest(CONFIG.dest.js.dev.es5))
]);
});
gulp.task('build/transpile.js.dev.es5', function() { gulp.task('build/transpile.js.dev.es5', function() {
return es5build({ return es5build({
src: CONFIG.dest.js.dev.es6, src: CONFIG.dest.js.dev.es6,