-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
38 lines (28 loc) · 1.23 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"use strict"
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var gulpBabel = require('gulp-babel');
var ts = require('gulp-typescript');
function compileTypescript(fileSpec, folder, singleFile) {
var options = {jsx: 'react', moduleResolution: 'node', target: 'ES6', module: 'CommonJS'}
if (singleFile)
options.out = singleFile
return gulp
.src(fileSpec)
.on('end', function() { console.log('Done compiling typescript, or actually just started'); })
.pipe(sourcemaps.init())
.pipe(ts(options))
.pipe(gulpBabel({presets: ['react', 'es2015', 'stage-0']})) // This blows up the module import
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(folder));
}
var appTsPath = ['./app/**/*.ts*', "./typings/index.d.ts"]
function compileTsAppForTests() {
return compileTypescript(appTsPath, './build/app') // Note: typescript requires the modules to be in the same relative directory.
}
gulp.task('buildTsAppForTests', function() {return compileTsAppForTests(); })
gulp.task('watchTsAppForTests', function() { return gulp.watch(appTsPath, ["buildTsAppForTests"]) });
gulp.task('build', ['buildTsAppForTests'])
gulp.task('watch', ['build', 'watchTsAppForTests']);
gulp.task('ci', ['build'])
gulp.task('default', ['watch']);