-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgulpfile.js
More file actions
42 lines (36 loc) · 1.13 KB
/
gulpfile.js
File metadata and controls
42 lines (36 loc) · 1.13 KB
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
var gulp = require('gulp');
var ts = require('gulp-type');
var tsd = require('gulp-tsd');
var sourcemaps = require('gulp-sourcemaps');
var del = require('del');
var insert = require('gulp-insert');
var tsProject = ts.createProject({
declarationFiles: true,
noExternalResolve: true,
sortOutput: true,
module: "commonjs"
});
gulp.task('ts-compile', ['ts-typings'], function () {
var tsResult = gulp.src(['src/*.ts', 'typings/**/*.ts'])
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
tsResult.dts.pipe(gulp.dest('./build/definitions'));
return tsResult.js.pipe(sourcemaps.write())
.pipe(insert.prepend("#!/usr/bin/env node\n"))
.pipe(gulp.dest('./build'));
})
gulp.task('ts-typings', function (cb) {
tsd({
command: 'reinstall',
config: './tsd.json'
},cb);
});
gulp.task('clean', function(cb) {
del(['build', 'typings'], cb);
});
gulp.task('default', function() {
gulp.start('ts-compile', 'ts-typings');
});
gulp.task('watch', ['ts-compile'], function() {
gulp.watch('src/*.ts', ['ts-compile']);
});