-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
76 lines (67 loc) · 1.75 KB
/
Copy pathgulpfile.js
File metadata and controls
76 lines (67 loc) · 1.75 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
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
var gulp = require('gulp');
var dts = require('dts-generator').default;
var ts = require('gulp-typescript');
var tslint = require('gulp-tslint');
var clean = require('gulp-clean');
var plumber = require('gulp-plumber');
var tsProject = ts.createProject('./tsconfig.json');
gulp.task('compile:clean', function() {
return gulp.src(['./index.d.ts', 'lib/'], { read: false, allowEmpty: true })
.pipe(clean());
});
gulp.task('compile:copyStaticAssets', function() {
return gulp.src(['./src/**/*', '!./**/*.ts'])
.pipe(gulp.dest('lib'));
});
gulp.task('compile:ts', function() {
return tsProject.src()
.pipe(plumber({
errorHandler: function (err) {
this.emit('end');
}
}))
.pipe(tsProject())
.pipe(gulp.dest('lib'));
});
gulp.task('compile:ts:lint', function() {
const program = require('tslint').Linter.createProgram('./tsconfig.json');
return gulp.src('src/**/*.ts')
.pipe(plumber({
errorHandler: function (err) {
this.emit('end');
}
}))
.pipe(tslint({
formatter: "verbose",
tslint: require('tslint'),
program
}))
.pipe(tslint.report());
});
gulp.task('compile:dts', function() {
return dts({
prefix: `${ require('./package.json').name }/lib`,
project: '.',
out: 'index.d.ts',
indent: ' '
})
});
gulp.task('default',
gulp.series(
'compile:clean',
gulp.parallel(
'compile:copyStaticAssets',
'compile:ts:lint',
'compile:ts',
'compile:dts'
)
)
);
gulp.task('watch',
gulp.series(
'default',
function() {
gulp.watch(['./src/**/*'], 'default');
}
)
);