Gotta have separate dist folders for each browser

This commit is contained in:
Tamius Han 2020-02-08 00:08:07 +01:00
parent 0ab21f8360
commit 806a889726
2 changed files with 12 additions and 9 deletions

View File

@ -4,10 +4,6 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const archiver = require('archiver'); const archiver = require('archiver');
const DEST_DIR = path.join(__dirname, '../dist');
const DEST_ZIP_DIR = path.join(__dirname, '../dist-zip');
const extractExtensionData = () => { const extractExtensionData = () => {
const extPackageJson = require('../dist/manifest.json'); const extPackageJson = require('../dist/manifest.json');
@ -43,7 +39,14 @@ const buildZip = (src, dist, zipFilename) => {
const main = () => { const main = () => {
const browser = process.argv[2]; const browser = process.argv[2];
const testingOrNightly = process.argv[3]; const testingOrNightly = process.argv[3];
let distDir;
if (browser == 'firefox') {
distDir = '../dist-ff';
} else {
distDir = `../dist-${browser}`
}
const destDir = path.join(__dirname, distDir);
const zipDir = path.join(__dirname, '../dist-zip');
const {name, version} = extractExtensionData(); const {name, version} = extractExtensionData();
// collapse spaces and dashes into single dash // collapse spaces and dashes into single dash
@ -52,9 +55,9 @@ const main = () => {
let realZipDir; let realZipDir;
if (!!testingOrNightly) { if (!!testingOrNightly) {
realZipDir = path.join(DEST_ZIP_DIR, version); realZipDir = path.join(zipDir, version);
} else { } else {
realZipDir = path.join(DEST_ZIP_DIR); realZipDir = path.join(zipDir);
} }
const zipFilename = `${baseFilename}-${browser}.zip`; const zipFilename = `${baseFilename}-${browser}.zip`;
@ -65,7 +68,7 @@ const main = () => {
console.error('Failed to make directory.\nDirectory we wanted to make', realZipDir, '\nerror we got:\n', e) console.error('Failed to make directory.\nDirectory we wanted to make', realZipDir, '\nerror we got:\n', e)
return 1; return 1;
} }
buildZip(DEST_DIR, realZipDir, zipFilename) buildZip(destDir, realZipDir, zipFilename)
.then(() => console.info('OK')) .then(() => console.info('OK'))
.catch(console.err); .catch(console.err);
}; };

View File

@ -17,7 +17,7 @@ const config = {
'options/options': './options/options.js', 'options/options': './options/options.js',
}, },
output: { output: {
path: __dirname + '/dist', path: __dirname + `/dist-${process.node.BROWSER == 'firefox' ? 'ff' : process.node.BROWSER}`,
filename: '[name].js', filename: '[name].js',
}, },
resolve: { resolve: {