-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (44 loc) · 1.05 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
const $ = require('gulp-load-plugins')();
const gulp = require('gulp');
const gulpWebpack = require('webpack-stream');
const karma = require('karma');
const path = require('path');
const pump = require('pump');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config');
gulp.task('clean', cb => pump([
gulp.src('./dist', { allowEmpty: true }),
$.clean(),
], cb));
gulp.task('lint', cb => pump([
gulp.src(['./src/**/*.js']),
$.eslint(),
$.eslint.format(),
$.eslint.failAfterError(),
], cb));
gulp.task('js', cb => pump([
gulpWebpack(
Object.assign(
webpackConfig,
{ mode: 'development' },
),
webpack,
),
gulp.dest('./dist'),
], cb));
gulp.task('build', gulp.series(
'clean',
'lint',
'js',
));
gulp.task('test:local', (done) => {
new karma.Server({
configFile: path.resolve(__dirname, './karma.conf.js'),
singleRun: false,
}, done).start();
});
gulp.task('test:ci', (done) => {
new karma.Server({
configFile: path.resolve(__dirname, './karma.conf.js'),
}, done).start();
});