-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
62 lines (56 loc) · 1.92 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
const gulp = require('gulp');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const watchify = require('watchify');
const tsify = require('tsify');
const terser = require('gulp-terser');
const sourcemaps = require('gulp-sourcemaps');
const buffer = require('vinyl-buffer');
const fancy_log = require('fancy-log');
const paths = {
pages: ['src/*.htm'],
css: ['node_modules/bootstrap/dist/css/bootstrap.min.css', 'node_modules/d3-flame-graph/dist/d3-flamegraph.css'],
js: ['node_modules/d3/dist/d3.min.js', 'node_modules/d3-tip/dist/index.js', 'node_modules/d3-flame-graph/dist/d3-flamegraph.min.js']
};
gulp.task('copy-html', function () {
return gulp.src(paths.pages)
.pipe(gulp.dest('dist'));
});
gulp.task('copy-css', function () {
return gulp.src(paths.css)
.pipe(gulp.dest('dist/css'));
});
gulp.task('copy-js', function () {
return gulp.src(paths.js)
.pipe(gulp.dest('dist/js'));
});
const watchedBrowserify = watchify(browserify({
basedir: '.',
debug: true,
entries: [
"src/Definitions.ts",
"src/ProgressMonitor.ts",
"src/CoreDumpAnalyzer.ts",
"src/IbmCoreDumpAnalyzer.ts",
"src/IbmSystemOutAnalyzer.ts",
"src/OpenJdkThreadDumpAnalyzer.ts",
"src/DumpFormatDetector.ts",
"src/main.ts"
],
cache: {},
packageCache: {}
}).plugin(tsify));
function bundle() {
return watchedBrowserify
.bundle()
.on('error', fancy_log)
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(terser())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist'));
}
gulp.task('default', gulp.series(gulp.parallel('copy-html', 'copy-css', 'copy-js'), bundle));
watchedBrowserify.on('update', bundle);
watchedBrowserify.on('log', fancy_log);