-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
48 lines (44 loc) · 1.09 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
39
40
41
42
43
44
45
46
47
48
// Copyright 2016 Frank Lin (lin.xiaoe.f@gmail.com). All rights reserved.
// Use of this source code is governed a license that can be found in the LICENSE file.
var gulp = require('gulp');
var rename = require('gulp-rename');
var ts = require('gulp-typescript');
var tsSourcemaps = require('gulp-sourcemaps');
var merge = require('merge2');
var clean = require('gulp-clean');
var runSequence = require('run-sequence');
/**
* $ gulp ts
*
* Compile TypeScript files into './lib'.
*/
var tsProject = ts.createProject('./tsconfig.json');
gulp.task('ts', function() {
var tsResult = tsProject.src()
.pipe(tsSourcemaps.init())
.pipe(tsProject());
return merge([
tsResult.js
.pipe(tsSourcemaps.write('.'))
.pipe(gulp.dest('./lib/js')),
tsResult.dts
.pipe(gulp.dest('./lib/definitions'))
]);
});
/**
* $ gulp clean
*
* Clean ./lib folder.
*/
gulp.task('clean', function() {
return gulp.src('./lib', {read: false})
.pipe(clean({force: true}));
});
/**
* $ gulp
*
* Clean ./lib and rebuild.
*/
gulp.task('default', function() {
runSequence('clean', 'ts');
});