From 814d389b6ea70f90d87b95063865db240b48a085 Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Mon, 30 Mar 2015 13:25:18 -0700 Subject: [PATCH] chore(gulp): add typescript transpilation tasks --- gulpfile.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 2ef9772565..47334b53a7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -24,7 +24,9 @@ var karma = require('karma').server; var minimist = require('minimist'); var es5build = require('./tools/build/es5build'); var runServerDartTests = require('./tools/build/run_server_dart_tests'); +var sourcemaps = require('gulp-sourcemaps'); var transformCJSTests = require('./tools/build/transformCJSTests'); +var tsc = require('gulp-typescript'); var ts2dart = require('gulp-ts2dart'); var util = require('./tools/build/util'); @@ -120,6 +122,7 @@ var CONFIG = { transpile: { src: { js: ['modules/**/*.js', 'modules/**/*.es6'], + ts: ['modules/**/*.ts'], dart: ['modules/**/*.js'] }, options: { @@ -297,6 +300,25 @@ gulp.task('build/transpile.js.dev.es6', transpile(gulp, gulpPlugins, { 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() { return es5build({ src: CONFIG.dest.js.dev.es6,