@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.
20 lines (18 loc) • 1.11 kB
text/typescript
import { generateSyncModelsAsync } from "../../generators/sync/sync-func.js";
import { parseModuleFileExtension } from "../arg.utils.js";
import type { CliArgumentsFetcher } from "../cli.models.js";
import { commandOptions } from "../command.options.js";
export async function syncActionAsync(cliFetcher: CliArgumentsFetcher): Promise<void> {
await generateSyncModelsAsync({
// required
createFiles: true,
environmentId: cliFetcher.getRequiredArgumentValue(commandOptions.environmentId.name),
managementApiKey: cliFetcher.getRequiredArgumentValue(commandOptions.managementApiKey.name),
// optional
disableComments: cliFetcher.getBooleanArgumentValue(commandOptions.disableComments.name, false),
managementBaseUrl: cliFetcher.getOptionalArgumentValue(commandOptions.managementBaseUrl.name),
outputDir: cliFetcher.getOptionalArgumentValue(commandOptions.outputDir.name),
addTimestamp: cliFetcher.getBooleanArgumentValue(commandOptions.addTimestamp.name, false),
moduleFileExtension: parseModuleFileExtension(cliFetcher.getOptionalArgumentValue(commandOptions.moduleFileExtension.name)),
});
}