hypertune
Version:
[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt
38 lines (30 loc) • 960 B
text/typescript
import "core-js/stable";
import "regenerator-runtime/runtime";
import cac from "cac";
import { registerGenerateCommand } from "./generate";
import { sdkVersion } from "../shared";
import loadEnvironmentVariables from "./loadEnvironmentVariables";
loadEnvironmentVariables();
async function main(): Promise<void> {
const cli = cac("hypertune");
registerGenerateCommand(cli);
cli.help();
cli.version(sdkVersion);
cli.parse(process.argv, { run: false });
try {
if (!cli.matchedCommand && !cli.options.help && !cli.options.version) {
throw new Error(
`Failed to match command "${process.argv.slice(2).join(" ")}"`
);
} else {
await cli.runMatchedCommand();
}
} catch (error: unknown) {
console.error("Error:", error instanceof Error ? error.message : error);
process.exit(1);
}
process.exit(0);
}
// eslint-disable-next-line @typescript-eslint/no-floating-promises
main();