2019-11-23 15:38:13 +03:00
|
|
|
const { setupBuild } = require("../build");
|
|
|
|
const { loadPackage, savePackage } = require("../local");
|
|
|
|
|
|
|
|
const arg = process.argv[2];
|
|
|
|
|
|
|
|
(async function() {
|
2020-04-18 12:23:36 +03:00
|
|
|
process.argv.slice(2).forEach((arg) => {
|
|
|
|
console.log("Setting Option:", arg);
|
|
|
|
switch(arg) {
|
|
|
|
case "esm":
|
|
|
|
setupBuild(true);
|
|
|
|
break;
|
2019-11-23 15:38:13 +03:00
|
|
|
|
2020-04-18 12:23:36 +03:00
|
|
|
case "cjs":
|
|
|
|
setupBuild(false);
|
|
|
|
break;
|
2019-11-23 15:38:13 +03:00
|
|
|
|
2020-04-18 12:23:36 +03: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 15:38:13 +03:00
|
|
|
delete info.browser;
|
|
|
|
savePackage("wordlists", info);
|
2020-04-18 12:23:36 +03:00
|
|
|
break;
|
2019-11-23 15:38:13 +03:00
|
|
|
}
|
|
|
|
|
2020-04-18 12:23:36 +03:00
|
|
|
default:
|
2020-04-18 12:44:51 +03:00
|
|
|
console.log("Unknown option:", arg);
|
2020-04-18 12:23:36 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
});
|
2019-11-23 15:38:13 +03:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
})().then((result) => {
|
|
|
|
process.exit(result);
|
|
|
|
});
|