forked from mjhea0/typescript-node-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
37 lines (30 loc) · 920 Bytes
/
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
const gulp = require('gulp');
const ts = require('gulp-typescript');
var del = require('del');
const JSON_FILES = ['src/*.json', 'src/**/*.json'];
const COMMAND_FILES = ['src/commands/*.sh'];
// pull in the project TypeScript config
const tsProject = ts.createProject('tsconfig.json');
gulp.task('scripts', () => {
const tsResult = tsProject.src()
.pipe(tsProject());
return tsResult.js.pipe(gulp.dest('dist'));
});
gulp.task('watch', ['scripts'], () => {
gulp.watch('src/**/*.ts', ['scripts']);
});
gulp.task('commands', function () {
return gulp.src(COMMAND_FILES)
.pipe(gulp.dest('dist/commands'));
});
gulp.task('assets', function () {
return gulp.src(JSON_FILES)
.pipe(gulp.dest('dist'));
});
gulp.task('clean', function () {
return del([
'dist/**/*'
]);
});
gulp.task('default', ['watch', 'assets', 'commands']);
gulp.task('build', ['clean', 'assets', 'commands', 'scripts']);