-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
41 lines (35 loc) · 1.05 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
const gulp = require('gulp');
const uglify = require('gulp-uglify-es').default;
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const path = require('path');
const fs = require('fs');
gulp.task('default', done => {
const package = require('./package.json');
const versionFolder = path.join('./web-scripts', `${package.version}`);
const latestFolder = path.join('./web-scripts', 'latest');
if (!fs.existsSync(versionFolder)) {
fs.mkdirSync(versionFolder);
}
const entry = 'dist/index.js';
browserify({
entries: entry,
standalone: 'ethereumBloomFilters'
})
.bundle()
.pipe(source(`ethereum-bloom-filters-${package.version}.min.js`))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(versionFolder));
browserify({
entries: entry,
standalone: 'ethereumBloomFilters'
})
.bundle()
.pipe(source(`ethereum-bloom-filters-latest.min.js`))
.pipe(buffer())
.pipe(uglify())
.pipe(gulp.dest(latestFolder));
done();
});