-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
82 lines (71 loc) · 1.82 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var gulp = require("gulp");
var del = require('del');
var ts = require("gulp-typescript");
var tslint = require("gulp-tslint");
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var tsProject = ts.createProject("tsconfig.json");
var tsSrc = ["src/**/*.ts", "src/**/*.tsx"];
var appSrc = ["app/**/*"];
gulp.task("build:ts", function() {
return gulp.src(tsSrc)
.pipe(tslint({
configuration: "tsconfig.json",
formatter: "verbose"
}))
.pipe(tslint.report({
emitError: true
}))
.pipe(tsProject())
.js
.pipe(gulp.dest("build"))
.on("error", function() {});
});
gulp.task('copy', ['copy:app', 'copy:ts'], function(cb) {
return cb();
});
gulp.task('copy:ts', ['build:ts'], function() {
return gulp.src([
'build/**/*',
'!**/.DS_Store'
], {
dot: true
}).pipe(gulp.dest('dist'));
});
gulp.task('copy:app', function() {
return gulp.src([
'app/**/*',
'!**/.DS_Store',
'!**/Thumbs.db'
], {
dot: true
}).pipe(gulp.dest('dist'));
});
gulp.task('clean', function() {
return del(['build', 'dist']);
});
gulp.task('browsersync', function(cb) {
browserSync({
port: 5000,
notify: false,
logPrefix: 'BS',
snippetOptions: {},
// https: true,
server: {
baseDir: ['build', 'app']
}
});
return cb();
});
gulp.task("serve", function(cb) {
gulp.watch(tsSrc, ["build:ts", reload]);
gulp.watch(appSrc, [reload]);
return runSequence(['build:ts'], 'browsersync', cb);
});
gulp.task('dist', ['clean'], function(cb) {
runSequence(['build:ts'], ['copy'], cb);
});
gulp.task('default', ['dist'], function(cb) {
return cb();
});