mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
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.
This commit is contained in:
parent
b4f4b29a03
commit
6e6e52fd8c
2 changed files with 25 additions and 0 deletions
|
@ -112,6 +112,30 @@ task('node', 'build the node binary', function() {
|
||||||
console.log('Node prepared.');
|
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() {
|
task('clean', 'remove all built files', function() {
|
||||||
execSync('rm -rf build test spec/support');
|
execSync('rm -rf build test spec/support');
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"test": "node make.js test",
|
"test": "node make.js test",
|
||||||
"build": "node make.js build",
|
"build": "node make.js build",
|
||||||
"webext": "node make.js webext",
|
"webext": "node make.js webext",
|
||||||
|
"pack-webext": "node make.js pack-webext",
|
||||||
"clean": "node make.js clean",
|
"clean": "node make.js clean",
|
||||||
"prepublish": "node make.js node",
|
"prepublish": "node make.js node",
|
||||||
"start": "node build/snowflake.js",
|
"start": "node build/snowflake.js",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue