-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (32 loc) · 876 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 clean = require('gulp-clean');
const {createProject} = require('gulp-typescript');
const jest = require('gulp-jest').default;
gulp.task('build', function() {
let failed = false;
const tsProject = createProject('tsconfig.json');
return gulp.src([
'src/**/*.ts',
'!**/__tests__/**'
], {nodir: true})
.pipe(tsProject())
.on('error', () => failed = true)
.on('finish', () => failed && process.exit(1))
.pipe(gulp.dest('lib'));
});
gulp.task('copy-config', function() {
return gulp.src([
'package.json',
'README.md',
'LICENSE'
]).pipe(gulp.dest('lib'));
})
gulp.task('test', function() {
return gulp.src('src/**/__tests__/**/*.ts')
.pipe(jest());
});
gulp.task('clean', () => {
return gulp.src('lib', {read: false})
.pipe(clean());
})
gulp.task('default',['build', 'test', 'copy-config']);