forked from nujabes403/iost-extension
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathgulpfile.js
50 lines (44 loc) · 1.38 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
var gulp = require('gulp')
var browserify = require('browserify')
var log = require('gulplog')
var tap = require('gulp-tap')
var buffer = require('gulp-buffer')
var sourcemaps = require('gulp-sourcemaps')
var uglify = require('gulp-uglify')
var brfs = require('brfs')
var rename = require('gulp-rename')
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var esbuild = require('esbuild')
gulp.task('browserify', function () {
return gulp
.src([
'public/app/inpage.js',
'public/app/content-script.js',
], { read: false }) // no need of reading file because browserify does.
// transform file objects using gulp-tap plugin
.pipe(tap(function (file) {
log.info('bundling ' + file.path);
// replace file contents with browserify's bundle stream
file.contents = browserify(file.path, {
debug: false,
transform: [ brfs ],
})
.bundle()
}))
.pipe(gulp.dest('dist/app'))
})
gulp.task('background', function () {
return esbuild.build({
entryPoints: ["public/app/background.js"],
bundle: true,
format: "esm",
outfile: "dist/app/background.js",
minify: true,
})
})
gulp.task('watch', function(){
gulp.watch(['./public/app/**/*.*'], gulp.series(['build']))
});
gulp.task('build', gulp.series(['browserify','background']))
gulp.task('default', gulp.series('build', 'watch'));