-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.babel.js
50 lines (44 loc) · 1.22 KB
/
gulpfile.babel.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
import gulp from 'gulp';
import ts from 'gulp-typescript';
import merge from 'merge2';
import typescript from 'typescript';
import sourcemaps from 'gulp-sourcemaps';
import babel from 'gulp-babel';
import del from 'del';
const tsProject = ts.createProject('tsconfig.json', { typescript });
gulp.task('clean', function(){
return del(['./release']);
});
gulp.task('ts', ['clean'], function(){
const result = gulp.src([
'./lib/**/*.ts',
'./manual-typings/**/*.d.ts',
'./typings/tsd.d.ts'
])
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
return merge([
result.dts.pipe(gulp.dest('./release/definitions')),
result.js.pipe(sourcemaps.write()).pipe(gulp.dest('./release/es6'))
]);
});
gulp.task('babel', ['ts'], function(){
return gulp.src('./release/es6/**/*.js')
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(babel({
presets: ['es2015']
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./release/cjs'));
});
gulp.task('build', ['babel'], function(){
return gulp.src([
'./release/cjs/**/*.js',
'./release/definitions/**/*.d.ts',
'!**/*.spec.d.ts',
'!**/*.spec.js',
'./package.json',
'./README.md'
])
.pipe(gulp.dest('./release/npm'));
});