-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
38 lines (31 loc) · 1020 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
'use strict'
let gulp = require('gulp');
let del = require('del');
let gutil = require('gulp-util');
let ts = require('gulp-typescript');
let rename = require('gulp-rename');
let replace = require('gulp-replace');
let bundle = require('gulp-file-bundle');
let sequence = require('run-sequence')
let tsProject = ts.createProject('tsconfig.json', {
typescript: require('typescript')
});
gulp.task('clean-lib', function () {
del(['lib']);
});
gulp.task('lib', ['clean-lib'], function () {
let tsResult = gulp.src('./src/**/*.{ts,tsx,js}', {base: 'src'})
.pipe(tsProject())
.on('error', function () {
let displayErr = gutil.colors.red('err');
gutil.log(displayErr);
this.emit('end');
});
return ([
tsResult.js.pipe(rename(function (path) {
path.dirname = path.dirname.replace(/^src\/?/, '');
})).pipe(gulp.dest('lib')),
tsResult.dts.pipe(gulp.dest('lib'))
])
});
gulp.task('default',['clean-lib', 'lib'])