-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (42 loc) · 1.22 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
47
48
49
50
51
52
53
54
55
56
const ava = require('gulp-ava');
const babel = require('rollup-plugin-babel');
const commonjs = require('rollup-plugin-commonjs');
const gulp = require('gulp');
const nodeResolve = require('rollup-plugin-node-resolve');
const sourcemaps = require('gulp-sourcemaps');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const { rollup } = require('rollup');
let cache;
gulp.task('rollup-then-babel', function () {
return rollup({
cache: cache,
entry: 'src/main.js',
plugins: [
babel({ exclude: 'node_modules/**' }),
commonjs(),
nodeResolve({ jsnext: true })
]
}).then(function (bundle) {
cache = bundle;
return bundle.write({
dest: 'intalg.umd.js',
format: 'umd',
moduleName: 'intalg',
sourceMap: true
});
});
});
gulp.task('process', [ 'rollup-then-babel' ], function () {
gulp
.src('intalg.umd.js')
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(rename('intalg.umd.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(''));
});
gulp.watch('src/**/*.js', [ 'default' ]);
gulp.task('default', [ 'process' ], function () {
gulp.src('specs/main.js').pipe(ava({ verbose: true }));
});