-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (36 loc) · 1.04 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
var gulp = require('gulp');
var ts = require('gulp-typescript');
var tsd = require('gulp-tsd');
var header = require('gulp-header');
var del = require('del');
var tsProject = ts.createProject({
declarationFiles: true,
noExternalResolve: false,
sortOuptut: true,
module: "commonjs"
});
gulp.task("ts-compile", ['ts-typings'], function() {
var tsResult = gulp.src(['src/*.ts', 'typings/**/*.ts'])
.pipe(ts(tsProject))
tsResult.dts.pipe(gulp.dest('build'));
return tsResult.js
.pipe(header('#!/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');
})
gulp.task('watch', function() {
gulp.watch('src/*.ts', ['ts-compile']);
})