@kontent-ai/model-generator
Version:
This utility generates strongly-typed models for Delivery JS SDK, Migration toolkit or just general scripting to improve the experience when referencing Kontent.ai related objects.
30 lines • 1.36 kB
JavaScript
import chalk from "chalk";
import { match } from "ts-pattern";
import { logError } from "../core/error.utils.js";
import { deliveryActionAsync } from "./actions/delivery-action.js";
import { environmentActionAsync } from "./actions/environment-action.js";
import { itemsActionAsync } from "./actions/items-action.js";
import { migrateActionAsync } from "./actions/migrate-action.js";
import { syncActionAsync } from "./actions/sync-action.js";
import { argumentsFetcherAsync } from "./args/args-fetcher.js";
import { cliArgs } from "./commands.js";
// This enables --help with all commands, options & samples
cliArgs.registerCommands();
try {
const argsFetcher = await argumentsFetcherAsync();
await match(argsFetcher.getCliAction())
.returnType()
.with("delivery-sdk", async () => await deliveryActionAsync(argsFetcher))
.with("migration-toolkit", async () => await migrateActionAsync(argsFetcher))
.with("environment", async () => await environmentActionAsync(argsFetcher))
.with("items", async () => await itemsActionAsync(argsFetcher))
.with("sync-sdk", async () => await syncActionAsync(argsFetcher))
.otherwise((action) => {
throw new Error(`Invalid action '${chalk.red(action)}'`);
});
}
catch (error) {
logError(error);
}
//# sourceMappingURL=app.js.map