forked from GoogleChromeLabs/ndb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
30 lines (24 loc) · 765 Bytes
/
build.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
const path = require('path');
const Terser = require('terser');
const rimraf = require('rimraf');
const { buildApp } = require('./scripts/builder.js');
const DEVTOOLS_DIR = path.dirname(
require.resolve('chrome-devtools-frontend/front_end/shell.json'));
(async function main() {
const outFolder = path.join(__dirname, '.local-frontend');
await new Promise(resolve => rimraf(outFolder, resolve));
return buildApp(
['ndb', 'heap_snapshot_worker', 'formatter_worker'], [
path.join(__dirname, 'front_end'),
DEVTOOLS_DIR,
path.join(__dirname, 'node_modules'),
], outFolder,
minifyJS);
})();
function minifyJS(code) {
return Terser.minify(code, {
mangle: true,
ecma: 8,
compress: false
}).code;
}