forked from i78s/ValidateJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
46 lines (38 loc) · 1.17 KB
/
gulpfile.js
File metadata and controls
46 lines (38 loc) · 1.17 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
43
44
45
46
var gulp = require('gulp');
var path = require('path');
var ts = require('gulp-typescript');
var tsProject = ts.createProject('tsconfig.json');
var exec = require('child_process').exec;
var CONFIG = {
path: {
ts: {
src: __dirname + '/src/*.ts',
dest: __dirname + '/lib'
}
}
};
gulp.task('default', ['watch']);
gulp.task('watch', ['ts'], function() {
gulp.watch(CONFIG.path.ts.src, ['ts']);
});
gulp.task('tsconfig', function (callback) {
return exec('$(npm bin)/tsconfig -u', (error, stdout, stderr) => {
if (stdout) console.log(`${stdout}`);
if (stderr) console.error(`${stderr}`);
if (error) console.error(`${error}`);
callback();
});
});
gulp.task('tsfmt', ["tsconfig"], (callback) => {
return exec('$(npm bin)/tsfmt -r', (error, stdout, stderr) => {
if (stdout) console.log(`${stdout}`);
if (stderr) console.error(`${stderr}`);
if (error) console.error(`${error}`);
callback();
});
});
gulp.task('ts', ["tsfmt", "tsconfig"], function () {
return gulp.src(CONFIG.path.ts.src)
.pipe(ts(tsProject))
.pipe(gulp.dest(CONFIG.path.ts.dest));
});