[tor-commits] [snowflake/master] Added packaging script for webextension

cohosh at torproject.org cohosh at torproject.org
Wed Oct 16 14:24:46 UTC 2019


commit 6e6e52fd8cc50941829b9b21bc4c086e57464fe7
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Thu Oct 10 10:52:28 2019 -0400

    Added packaging script for webextension
    
    Added a new script to package the webextension. This will automatically
    build and zip the source code and the webextension for upload. It take a
    version as an argument and then checks the version in the manifest, and
    locally commits a version bump.
---
 proxy/make.js      | 24 ++++++++++++++++++++++++
 proxy/package.json |  1 +
 2 files changed, 25 insertions(+)

diff --git a/proxy/make.js b/proxy/make.js
index f8f9d7f..9f8b6bb 100755
--- a/proxy/make.js
+++ b/proxy/make.js
@@ -112,6 +112,30 @@ task('node', 'build the node binary', function() {
   console.log('Node prepared.');
 });
 
+task('pack-webext', 'pack the webextension for deployment', function() {
+  try {
+    execSync(`rm -f source.zip`);
+    execSync(`rm -f webext/webext.zip`);
+  } catch (error) {
+    console.log('Error removing zip files');
+  }
+  execSync(`git submodule update --remote`);
+  var version = process.argv[3];
+  console.log(version);
+  var manifest = require('./webext/manifest.json')
+  manifest.version = version;
+  writeFileSync('./webext/manifest.json', JSON.stringify(manifest, null, 2), 'utf8');
+  execSync(`git commit -am "bump version to ${version}"`);
+  try {
+    execSync(`git tag webext-${version}`);
+  } catch (error) {
+    console.log('Error creating git tag');
+  }
+  execSync(`git archive -o source.zip HEAD .`);
+  execSync(`npm run webext`);
+  execSync(`cd webext && zip -Xr webext.zip ./*`);
+});
+
 task('clean', 'remove all built files', function() {
   execSync('rm -rf build test spec/support');
 });
diff --git a/proxy/package.json b/proxy/package.json
index c5a571b..d070c5b 100644
--- a/proxy/package.json
+++ b/proxy/package.json
@@ -10,6 +10,7 @@
     "test": "node make.js test",
     "build": "node make.js build",
     "webext": "node make.js webext",
+    "pack-webext": "node make.js pack-webext",
     "clean": "node make.js clean",
     "prepublish": "node make.js node",
     "start": "node build/snowflake.js",





More information about the tor-commits mailing list