-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
43 lines (36 loc) · 1.17 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
const del = require('del')
const gulp = require('gulp')
const zip = require('gulp-zip')
const gulpFilter = require('gulp-filter')
const jsonEditor = require('gulp-json-editor')
const pkg = require('./package.json')
const src = 'src/**/*'
const output = 'output/'
const target = 'like-i-give-a-fuck-' + pkg.version
gulp.task('clean', () => {
return del([output + '**/*'])
})
gulp.task('build:firefox', () => {
const filter = gulpFilter('**/manifest.json', { restore: true })
return gulp.src(src)
.pipe(filter)
.pipe(jsonEditor({ version: pkg.version }))
.pipe(filter.restore)
.pipe(zip(target + '.xpi'))
.pipe(gulp.dest(output))
})
gulp.task('build:chrome', () => {
const filter = gulpFilter('**/manifest.json', { restore: true })
return gulp.src(src)
.pipe(filter)
.pipe(jsonEditor((manifest) => {
manifest.version = pkg.version
delete manifest.applications
return manifest
}))
.pipe(filter.restore)
.pipe(gulp.dest(output + target))
.pipe(zip(target + '.zip'))
.pipe(gulp.dest(output))
})
gulp.task('default', gulp.series('clean', gulp.parallel('build:firefox', 'build:chrome')))