webext-store-incompat-fixer
Version:
Package which clones a packed webextension and fixes incompatibilities with certain extension stores
42 lines (33 loc) • 956 B
JavaScript
/* eslint-disable no-console */
import generate from './index.js';
const argList = process.argv.join('=').split('=');
let inputPath = null;
let edgeLocaleInclusions = null;
let beta = false;
const stores = [];
argList.forEach((item, index) => {
if (item === '--input' || item === '-i') {
inputPath = argList[index + 1];
} else if (item === '--stores' || item === '--store' || item === '-s') {
stores.push(...argList[index + 1].toLowerCase().split(/[^a-z]/));
} else if (item === '--edge-locale-inclusions') {
edgeLocaleInclusions = argList[index + 1].split(',');
} else if (item === '--beta') {
beta = true;
}
});
function logChangesOnSuccess ({ messageLog }) {
messageLog.forEach((message) => {
console.log(message);
});
}
function logErrors (...errors) {
console.error(...errors);
}
generate({
inputPath,
stores,
edgeLocaleInclusions,
beta,
}).then(logChangesOnSuccess, logErrors);