-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgulpfile.js
More file actions
72 lines (64 loc) · 1.25 KB
/
gulpfile.js
File metadata and controls
72 lines (64 loc) · 1.25 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
'use strict';
const gulp = require('gulp');
const gulpLoadPlugins = require('gulp-load-plugins');
const webpack = require('webpack-stream');
const browserSync = require('browser-sync');
const $ = gulpLoadPlugins();
const reload = browserSync.reload;
/**
* regression test
*/
gulp.task('watch:test', () => {
gulp.watch([
'src/**/*',
'test/**/*'
], gulp.series('test'));
});
/**
* unit test
*/
gulp.task('test', () => {
return gulp.src('test/**/inter*.js')
.pipe($.plumber())
.pipe($.spawnMocha());
});
/**
* build source code as eisenscript library
*/
gulp.task('webpack', () => {
const config = require('./webpack.config');
const entry = Object.values(config.entry);
return gulp.src(entry)
.pipe(webpack(config))
.pipe(gulp.dest('build/'));
});
/**
* start web app
*/
gulp.task('serve', () => {
browserSync({
notify: false,
port: 9000,
startPath: '/examples',
open: 'external',
server: {
baseDir: ['.']
}
});
gulp.watch([
'src/**/*'
], gulp.series('webpack'));
gulp.watch([
'src/**/*',
'examples/**/*',
]).on('change', reload);
});
gulp.task('serve:dist', () => {
browserSync({
notify: false,
port: 9000,
server: {
baseDir: ['dist']
}
});
});