Let's make a script that does both ff and chrome build at the same time

+ let's automate making source code zip for AMO, while we're at it
This commit is contained in:
Tamius Han 2019-09-22 02:38:13 +02:00
parent 46bc4bfd8d
commit ecf495dae6
3 changed files with 11 additions and 2 deletions

View File

@ -11,6 +11,7 @@
"build:dev": "cross-env NODE_ENV=development BROWSER=firefox webpack --hide-modules",
"build-chrome:dev": "cross-env NODE_ENV=development BROWSER=chrome webpack --hide-modules",
"build-edge:dev": "cross-env NODE_ENV=development BROWSER=edge webpack --hide-modules",
"build-all": "rm ./dist-zip/uw-amo-source.zip; mv ./dist-zip/*.zip ./dist-zip/old/; npm run build; node scripts/build-zip.js ff; npm run build-chrome; node scripts/build-zip.js chrome; ./scripts/prepare-amo-source.sh",
"build-zip": "node scripts/build-zip.js",
"watch": "npm run build -- --watch",
"watch-chrome": "npm run build-chrome -- --watch",

View File

@ -7,8 +7,9 @@ const archiver = require('archiver');
const DEST_DIR = path.join(__dirname, '../dist');
const DEST_ZIP_DIR = path.join(__dirname, '../dist-zip');
const extractExtensionData = () => {
const extPackageJson = require('../package.json');
const extPackageJson = require('../src/manifest.json');
return {
name: extPackageJson.name,
@ -40,8 +41,10 @@ const buildZip = (src, dist, zipFilename) => {
};
const main = () => {
const browser = process.argv[2];
const {name, version} = extractExtensionData();
const zipFilename = `${name}-v${version}.zip`;
const zipFilename = `${name}-${version}-${browser}.zip`;
makeDestZipDirIfNotExists();

5
scripts/prepare-amo-source.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# makes a zip file with human-readable source code that we need to upload to AMO
# since webpack minifies stuff
zip -r dist-zip/uw-amo-source.zip README-AMO.md .babelrc package.json package-lock.json webpack.config.js src/