-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
57 lines (48 loc) · 1.44 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
57
const gulp = require('gulp'),
pkg = require('./package.json'),
BundleHelper = require('maptalks-build-helpers').BundleHelper,
babel = require('maptalks-rollup-plugin-babel'),
commonjs = require('rollup-plugin-commonjs'),
localResolve = require('rollup-plugin-local-resolve'),
nodeResolve = require('rollup-plugin-node-resolve');
const bundleHelper = new BundleHelper(pkg);
console.log(bundleHelper)
gulp.task('build', () => {
return bundleHelper.bundle('index.js', {
'external': [
'maptalks',
'rbush'
],
'plugins': [
localResolve(),
nodeResolve({
module: true,
jsnext: true,
main: true
}),
commonjs(),
babel({
plugins: ['transform-proto-to-assign']
})
]
});
});
gulp.task('minify', ['build'], () => {
bundleHelper.minify();
});
gulp.task('watch', ['build'], () => {
gulp.watch(['index.js', './gulpfile.js'], ['build']);
});
/*
const TestHelper = require('maptalks-build-helpers').TestHelper;
const testHelper = new TestHelper();
const karmaConfig = require('./karma.config.js');
gulp.task('test', ['build'], () => {
testHelper.test(karmaConfig);
});
gulp.task('tdd', ['build'], () => {
karmaConfig.singleRun = false;
gulp.watch(['index.js'], ['test']);
testHelper.test(karmaConfig);
}); */
gulp.task('default', ['watch']);