-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (59 loc) · 1.48 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const { src, dest, series, watch } = require("gulp");
const zip = require("gulp-zip");
const babel = require("gulp-babel");
const packageMeta = require("./package.json");
/**
* copy dependencies files to vendor
* @return {*}
*/
function copyDependencies() {
const srcFiles = [
"node_modules/bootstrap/dist/css/bootstrap-reboot.css",
"node_modules/@buuug7/simplify-button/index.css",
"node_modules/@buuug7/simplify-form/index.css",
"node_modules/utilities-css/dist/utilities-css.css",
"node_modules/react/umd/react.production.min.js",
"node_modules/react-dom/umd/react-dom.production.min.js",
];
return src(srcFiles, { base: "node_modules" }).pipe(dest("vendor/"));
}
const filesOfZip = [
"images/*",
"vendor/**/*",
"background.js",
"book.html",
"book.js",
"CHANGELOG.md",
"lib.js",
"manifest.json",
"options.html",
"options.js",
"popup.html",
"popup.js",
"README.md",
];
/**
* zip files and for uploaded to chrome web store
* @return {*}
*/
function zipFiles() {
return src(filesOfZip, { base: "." })
.pipe(zip(`${packageMeta.name}-v${packageMeta.version}.zip`))
.pipe(dest("."));
}
const jsxFiles = ["src/**/*.jsx"];
function jsxCompile() {
return src(jsxFiles).pipe(babel()).pipe(dest("."));
}
function jsxWatch() {
watch(jsxFiles, function (cb) {
jsxCompile();
cb();
});
}
module.exports = {
copyDependencies,
jsxCompile,
watch: series(jsxWatch),
default: series(copyDependencies, jsxCompile, zipFiles),
};