forked from openzipkin/zipkin-browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
35 lines (33 loc) · 893 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
31
32
33
34
35
#!/usr/env/node
const webpack = require('webpack');
const JSZip = require('jszip');
const fs = require('fs');
const webpackConfig = Object.assign(
{},
require('./webpack.config.js'), {
bail: true
}
);
console.log('Running Webpack...');
webpack(webpackConfig, (err, stats) => {
if (err) {
console.log('Webpack error', err.message);
process.exit(1);
} else {
console.log('Webpack run OK');
console.log('Generating zip...');
const zip = new JSZip();
[
'devtools.html',
'manifest.json',
'panel.html',
'zipkin.png',
'dist/background.bundle.js',
'dist/devtools.bundle.js',
'dist/panel.bundle.js'
].forEach(f => zip.file(f, fs.readFileSync(f)));
fs.writeFileSync('dist/zipkin-chrome-extension.zip', zip.generate({type: 'nodebuffer'}));
console.log('Zip was generated.');
// zip.folder('dist');
}
});