2019-11-23 21:38:13 +09:00
|
|
|
const { setupBuild } = require("../build");
|
|
|
|
const { loadPackage, savePackage } = require("../local");
|
|
|
|
|
|
|
|
const arg = process.argv[2];
|
|
|
|
|
|
|
|
(async function() {
|
2020-04-18 05:23:36 -04:00
|
|
|
process.argv.slice(2).forEach((arg) => {
|
|
|
|
console.log("Setting Option:", arg);
|
|
|
|
switch(arg) {
|
|
|
|
case "esm":
|
|
|
|
setupBuild(true);
|
|
|
|
break;
|
2019-11-23 21:38:13 +09:00
|
|
|
|
2020-04-18 05:23:36 -04:00
|
|
|
case "cjs":
|
|
|
|
setupBuild(false);
|
|
|
|
break;
|
2019-11-23 21:38:13 +09:00
|
|
|
|
2020-04-18 05:23:36 -04:00
|
|
|
// This will remove the browser field entirely, so make sure
|
|
|
|
// to set esm of cjs first as they will restore the browser
|
|
|
|
// field
|
|
|
|
case "browser-lang-all": {
|
|
|
|
const info = loadPackage("wordlists");
|
2019-11-23 21:38:13 +09:00
|
|
|
delete info.browser;
|
|
|
|
savePackage("wordlists", info);
|
2020-04-18 05:23:36 -04:00
|
|
|
break;
|
2019-11-23 21:38:13 +09:00
|
|
|
}
|
|
|
|
|
2020-04-18 05:23:36 -04:00
|
|
|
default:
|
2020-04-18 05:44:51 -04:00
|
|
|
console.log("Unknown option:", arg);
|
2020-04-18 05:23:36 -04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
});
|
2019-11-23 21:38:13 +09:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
})().then((result) => {
|
|
|
|
process.exit(result);
|
|
|
|
});
|