convert @babel/cli to typescript (#13213)

* babel-cli flowts rename

* babel-cli flowts convert

* babel-cli

* yarn install
This commit is contained in:
Bogdan Savluk
2021-05-14 09:32:38 +02:00
committed by GitHub
parent 5def29d1ca
commit bb70ea47f5
6 changed files with 18 additions and 30 deletions

View File

@@ -0,0 +1,30 @@
import commander from "commander";
import { buildExternalHelpers } from "@babel/core";
function collect(
value: string | any,
previousValue: Array<string>,
): Array<string> {
// If the user passed the option with no value, like "babel-external-helpers --whitelist", do nothing.
if (typeof value !== "string") return previousValue;
const values = value.split(",");
return previousValue ? previousValue.concat(values) : values;
}
commander.option(
"-l, --whitelist [whitelist]",
"Whitelist of helpers to ONLY include",
collect,
);
commander.option(
"-t, --output-type [type]",
"Type of output (global|umd|var)",
"global",
);
commander.usage("[options]");
commander.parse(process.argv);
console.log(buildExternalHelpers(commander.whitelist, commander.outputType));