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
|
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const manifest = require('../manifest');
const JSZip = require('jszip');
const resources = () => {
return [
'manifest.json',
'resources/disabled_32x32.png',
'resources/enabled_32x32.png',
manifest.options_ui.page,
'build/settings.js',
].concat(
Object.values(manifest.icons),
manifest.background.scripts,
manifest.content_scripts.map(cs => cs.js).reduce((a1, a2) => a1.concat(a2), []),
manifest.web_accessible_resources,
).sort();
};
const output = `vim-vixen-${manifest.version}.zip`
let basedir = path.join(__dirname, '..');
let zip = new JSZip();
for (let r of resources()) {
console.log(` adding: ${r}`)
let data = fs.readFileSync(path.join(basedir, r));
zip.file(r, data);
}
zip
.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
.pipe(fs.createWriteStream(output))
.on('finish', function () {
console.log(`${output} created`);
});
|