-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
60 lines (52 loc) · 1.47 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
49
50
51
52
53
54
55
56
57
58
59
60
'use strict'
const gulp = require('gulp');
const gulpTs = require('gulp-typescript');
const gulpTslint = require('gulp-tslint');
const tslint = require('tslint');
const sourcemaps = require('gulp-sourcemaps');
const del = require('del');
const path = require('path');
const nodemon = require('gulp-nodemon');
const project = gulpTs.createProject('tsconfig.json');
const typeCheck = tslint.Linter.createProgram('tsconfig.json');
gulp.task('lint', () => {
return gulp.src('./src/**/*.ts')
.pipe(gulpTslint({
configuration: 'tslint.json',
formatter: 'prose',
program: typeCheck
}))
.pipe(gulpTslint.report());
})
gulp.task('build', ['lint'], () => {
del.sync(['./bin/**/*.*']);
gulp.src('./src/**/*.js')
.pipe(gulp.dest('bin/'));
gulp.src('./src/**/*.json')
.pipe(gulp.dest('bin/'));
gulp.src('./src/**/*.png')
.pipe(gulp.dest('bin/'));
gulp.src('./src/**/*.ttf')
.pipe(gulp.dest('bin/'));
const tsCompile = gulp.src('./src/**/*.ts')
.pipe(sourcemaps.init())
.pipe(project());
return tsCompile.js
.pipe(sourcemaps.write({ sourceRoot: file => path.relative(path.join(file.cwd, file.path), file.base) }))
.pipe(gulp.dest('bin/'));
});
gulp.task('watch', ['build'], function() {
gulp.watch('./src/**/*.ts', ['build']);
});
gulp.task('start', ['build'], function() {
return nodemon({
script: './bin/index.js',
watch: './bin/index.js'
})
})
gulp.task('serve', ['watch'], function() {
return nodemon({
script: './bin/index.js',
watch: './bin/'
})
});