-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathgulpfile.js
48 lines (43 loc) · 1.47 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
const gulp = require("gulp");
const gulp_zip = require("gulp-zip");
const gulp_rename = require('gulp-rename');
const gulp_json_modify = require("gulp-json-modify");
const merge_stream = require("merge-stream");
const pkg = require("./package.json");
gulp.task("bundle:chrome", () => {
const others = gulp.src(["src/**", "!src/manifest.json", "!src/manifest.firefox.json", "!src/**/*.ts", "!src/**/*.js.map"]);
const manifest = gulp.src("src/manifest.json").pipe(
gulp_json_modify({
key: "version",
value: pkg.version,
}),
);
return merge_stream(manifest, others)
.pipe(gulp_zip("bundle.zip"))
.pipe(gulp.dest("dist/chrome"));
});
gulp.task("bundle:firefox", () => {
const others = gulp.src(["src/**", "!src/manifest.json", "!src/manifest.firefox.json", "!src/**/*.ts", "!src/**/*.js.map"]);
const manifest = gulp
.src("src/manifest.firefox.json")
.pipe(
gulp_json_modify({
key: "version",
value: pkg.version,
}),
)
.pipe(gulp_rename('manifest.json'));
return merge_stream(manifest, others)
.pipe(gulp_zip("bundle.zip"))
.pipe(gulp.dest("dist/firefox"));
});
/**
* Task for CI/CD
* Use git to revert changes if call it locally
*/
gulp.task('apply:manifest:firefox', () => {
return gulp
.src("src/manifest.firefox.json")
.pipe(gulp_rename('manifest.json'))
.pipe(gulp.dest("src"))
});