Support for updated shapes

This commit is contained in:
Endeavorance 2025-03-08 14:45:08 -05:00
parent 9d4907aa25
commit d8ddff01a6
6 changed files with 58 additions and 65 deletions

View file

@ -1,7 +1,7 @@
import { parseArgs } from "node:util";
import { ValidatedPlaybillSchema, checkDirectives } from "@proscenium/playbill";
import { ValidatedPlaybillSchema } from "@proscenium/playbill";
import chalk from "chalk";
import { loadFromBinding } from "./binding";
import { loadFromBinding, resolveBindingPath } from "./binding";
import { usage } from "./usage";
import { CLIError, MuseError } from "./errors";
@ -74,7 +74,8 @@ async function main(): Promise<number> {
}
// -- BINDING FILE -- //
const bindingPath = args[0] ?? "./binding.yaml";
const bindingPathInput = args[0] ?? "./binding.yaml";
const bindingPath = await resolveBindingPath(bindingPathInput);
verboseLog(`Building Playbill with binding: ${bindingPath}`);
@ -94,19 +95,12 @@ async function main(): Promise<number> {
return ExitCode.Error;
}
const directiveValidationResult = checkDirectives(validatedPlaybill.data);
if (!directiveValidationResult) {
console.error("Error validating playbill directives");
return ExitCode.Error;
}
verboseLog("Playbill validated");
// -- EXIT EARLY IF JUST CHECKING VALIDATION --//
if (options.check) {
console.log(chalk.green("Playbill validated successfully"));
return ExitCode.Error;
return ExitCode.Success;
}
// -- SERIALIZE TO JSON --//