-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (32 loc) · 1.18 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
var gulp = require('gulp');
var babel = require('gulp-babel');
var clean = require('gulp-clean');
var flatten = require('gulp-flatten');
var replace = require('gulp-replace');
var sourcemaps = require('gulp-sourcemaps');
var ts = require('gulp-typescript');
const tsProject = ts.createProject('tsconfig.json');
var cleanTask = function () {
return gulp.src(['./dist'], { read: false, allowEmpty: true })
.pipe(clean());
};
var buildTask = function () {
return gulp.src('./src/**/*.js')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'), { sourceRoot: 'src' })
.pipe(gulp.dest('./dist'));
};
var copyDeclarationsTask = function () {
return gulp.src('./src/**/*.d.ts')
.pipe(gulp.dest('./dist'));
};
var defaultTask = gulp.series(cleanTask, gulp.parallel(buildTask, copyDeclarationsTask));
gulp.task('clean', cleanTask);
gulp.task('build', gulp.series(cleanTask, gulp.parallel(buildTask, copyDeclarationsTask)));
gulp.task('copy-declarations', copyDeclarationsTask);
gulp.task('default', defaultTask);
exports.cleanTask = cleanTask;
exports.buildTask = buildTask;
exports.copyDeclarationsTask = copyDeclarationsTask;
exports.defaultTask = defaultTask;