This repository has been archived by the owner on Apr 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
63 lines (48 loc) · 1.46 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
55
56
57
58
59
60
61
62
63
import gulp from "gulp"
import loadPlugins from "gulp-load-plugins"
import webpack from "webpack"
import rimraf from "rimraf"
import bump from "gulp-bump"
const plugins = loadPlugins()
import popupWebpackConfig from "./popup/webpack.config"
import eventWebpackConfig from "./event/webpack.config"
gulp.task("popup-js", ["clean"], cb => {
webpack(popupWebpackConfig, (err, stats) => {
if (err) throw new plugins.util.PluginError("webpack", err)
plugins.util.log("[webpack]", stats.toString())
cb()
})
})
gulp.task("event-js", ["clean"], cb => {
webpack(eventWebpackConfig, (err, stats) => {
if (err) throw new plugins.util.PluginError("webpack", err)
plugins.util.log("[webpack]", stats.toString())
cb()
})
})
gulp.task("popup-html", ["clean"], () => {
return gulp
.src("popup/src/index.html")
.pipe(plugins.rename("popup.html"))
.pipe(gulp.dest("./build"))
})
gulp.task("copy", ["clean"], () => {
return gulp
.src(["manifest.json", "audio/*", "icons/out/*"])
.pipe(gulp.dest("./build"))
})
gulp.task("clean", cb => {
rimraf("./build", cb)
})
gulp.task("bump", function() {
gulp
.src("./manifest.json")
.pipe(bump({ type: "minor" }))
.pipe(gulp.dest("./"))
})
gulp.task("build", ["copy", "popup-js", "popup-html", "event-js"])
gulp.task("watch", ["default"], () => {
gulp.watch(["popup/**/*", "common/**"], ["build"])
gulp.watch(["event/**/*", "common/**"], ["build"])
})
gulp.task("default", ["build"])