Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc-browser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Vänttinen <sami.vanttinen@protonmail.com>2019-03-26 21:08:50 +0300
committerJanek Bevendorff <janek@jbev.net>2019-03-26 21:08:50 +0300
commit252732c22f583803c847737dcf1091f8fe2ed6cc (patch)
tree99bacd64338cc9ad52d5f6e3ddf1be6bdc25d457 /build.js
parent01dfa8eff03d1aad69ea7cb49c13cbaa9527b05a (diff)
Use separate manifests (#398)1.3.3
Diffstat (limited to 'build.js')
-rw-r--r--build.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/build.js b/build.js
new file mode 100644
index 0000000..f654cbb
--- /dev/null
+++ b/build.js
@@ -0,0 +1,48 @@
+'use strict';
+
+const fs = require('fs');
+const extra = require('fs-extra');
+const zaf = require('zip-a-folder');
+
+const DEST = 'keepassxc-browser';
+const DEFAULT = 'manifest_default.json';
+const BROWSERS = {
+ 'Firefox': 'manifest_firefox.json',
+ 'Chromium': 'manifest_chromium.json',
+};
+
+function adjustManifest(manifest) {
+ const manifestFile = fs.readFileSync(DEFAULT, 'utf8');
+ const data = JSON.parse(manifestFile);
+ const browser = manifest.substring(manifest.indexOf('_') + 1, manifest.indexOf('.'));
+
+ if (manifest.includes('firefox')) {
+ for (const elem in data['icons']) {
+ data['icons'][elem] = 'icons/keepassxc.svg';
+ }
+ for (const elem in data['browser_action']['default_icon']) {
+ data['browser_action']['default_icon'][elem] = 'icons/keepassxc.svg';
+ }
+ } else if (manifest.includes('chromium')) {
+ delete data['applications'];
+ }
+
+ fs.writeFileSync(manifest, JSON.stringify(data, null, 4));
+ return `keepassxc-browser_${data['version']}_${browser}.zip`;
+}
+
+(async() => {
+ fs.copyFileSync(`${DEST}/manifest.json`, `./${DEFAULT}`);
+
+ for (const browser in BROWSERS) {
+ console.log(`KeePassXC-Browser: Creating extension package for ${browser}`);
+ const fileName = adjustManifest(BROWSERS[browser]);
+ fs.copyFileSync(BROWSERS[browser], `${DEST}/manifest.json`);
+ extra.removeSync(fileName);
+ await zaf.zip(DEST, fileName);
+ extra.removeSync(BROWSERS[browser]);
+ console.log('Done');
+ }
+
+ fs.renameSync(DEFAULT, `${DEST}/manifest.json`);
+})()