-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (38 loc) · 1.13 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
40
41
42
43
44
45
46
const gulp = require('gulp');
const sequence = require('gulp-sequence');
const shell = require('gulp-shell');
gulp.task('clean', shell.task('rm -rf ./dist/'));
gulp.task('compile-ts', shell.task('tsc'));
gulp.task('compile-ts-umd', shell.task('tsc -m umd --outDir ./dist/umd/'));
gulp.task('copy-files', () => {
return gulp.src('./package.json')
.pipe(gulp.dest('./dist/'));
});
gulp.task('default', sequence('clean', 'compile-ts', 'pack', 'min', 'copy-files', 'compile-ts-umd'));
gulp.task('pack', () => {
const browserify = require('browserify');
const fs = require('fs');
return browserify(['./dist/index.js'], {
standalone: 'dask'
})
.bundle()
.pipe(fs.createWriteStream('./dist/dask.js'));
});
gulp.task('min', (cb) => {
const rename = require('gulp-rename');
const babel = require('gulp-babel');
const uglify = require('gulp-uglify');
const pump = require('pump');
pump([
gulp.src('./dist/dask.js'),
babel({
presets: ['env'],
plugins: ['transform-runtime']
}),
uglify(),
rename('dask.min.js'),
gulp.dest('./dist/')
], cb);
});
gulp.task('watch-ts', shell.task('tsc -w'));
gulp.task('dev', ['watch-ts']);