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:
Cecylia Bocovich 2019-10-10 10:52:28 -04:00
parent b4f4b29a03
commit 6e6e52fd8c
2 changed files with 25 additions and 0 deletions

View file

@ -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');
});