-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.babel.js
55 lines (46 loc) · 1.11 KB
/
gulpfile.babel.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
'use strict';
const del = require('del');
const gulp = require('gulp');
const zip = require('gulp-zip');
const jscs = require('gulp-jscs');
const gutil = require('gulp-util');
const webpack = require('webpack');
const eslint = require('gulp-eslint');
const webpackConfig = require('./webpack.config');
const files = {
release: [
'manifest.json',
'options.js',
'fill-pull-body.js',
'background.js',
'html/**',
'img/**',
'style/**',
'vendor/**'
]
};
function bundle(callback){
webpack(webpackConfig, function(err){
gutil.log('Webpack bundle complete!');
callback(err);
});
}
function lint(){
return gulp.src('src/**/*.js')
.pipe(eslint())
.pipe(eslint.format())
.pipe(jscs())
.pipe(eslint.failAfterError());
}
function postinstall(callback){
del('node_modules/**/*.pem', callback);
}
function release(){
return gulp.src(files.release, { base: __dirname })
.pipe(zip('git-splainin.zip'))
.pipe(gulp.dest('dist'));
}
gulp.task(lint);
gulp.task(postinstall);
gulp.task('release', gulp.series(bundle, release));
gulp.task('default', gulp.parallel(bundle));