You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

40 lines
992 B

#!/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`);
});