@common-grants/cli
Version:
The CommonGrants protocol CLI tool
28 lines (27 loc) • 999 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.compileCommand = compileCommand;
const compile_service_1 = require("./compile-service");
const compile_args_1 = require("./compile-args");
function compileCommand(program) {
const compileService = new compile_service_1.DefaultCompileService();
program
.command("compile")
.description("Compile a TypeSpec file to OpenAPI")
.argument("<typespecPath>", "Path to TypeSpec file (.tsp)")
.action(async (typespecPath) => {
try {
const validatedArgs = compile_args_1.CompileArgsSchema.parse({ typespecPath });
await compileService.compile(validatedArgs.typespecPath);
}
catch (error) {
if (error instanceof Error) {
console.error(error.message);
}
else {
console.error("Error compiling spec:", error);
}
process.exit(1);
}
});
}