forked from queueit/KnownUser.V3.Cloudflare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (45 loc) · 1.37 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
const {src, dest, series} = require("gulp");
const tsify = require("tsify");
const jsonModify = require('gulp-json-modify');
const vinylSource = require('vinyl-source-stream');
const browserify = require('browserify');
const babelify = require('babelify');
const tar = require('gulp-tar');
const gzip = require('gulp-gzip');
function bundle(){
return browserify({
basedir: ".",
debug: false,
entries: ["app.ts"],
cache: {},
packageCache: {},
})
.ignore("./miniflare.ts")
.plugin(tsify)
.transform(babelify, {
global: true,
sourceMaps: true,
ignore: [/\/node_modules\/(?!yaml\/)/],
presets: ["es2015"]
})
.bundle()
.pipe(vinylSource("queueitknownuser.bundle.js"))
.pipe(dest("./dist"));
}
function makePackage() {
return src([
'./dist/queueitknownuser.bundle.js',
])
.pipe(tar('worker.tar'))
.pipe(gzip())
.pipe(dest('./dist'));
}
exports.stripPackage = () => {
return src(['./package.json'])
.pipe(jsonModify({ key: 'devDependencies', value: {}}))
.pipe(jsonModify({ key: 'scripts', value: {}}))
.pipe(dest('./'))
}
exports.buildArtifacts = series(bundle, makePackage);
exports.default = exports.buildArtifacts;
exports.bundle = bundle;