UNPKG

convex

Version:

Client for the Convex Cloud

31 lines (30 loc) 1.13 kB
"use strict"; import chalk from "chalk"; import { functionsDir, ensureHasConvexDependency } from "./lib/utils"; import { Command } from "commander"; import { readConfig } from "./lib/config"; import { typeCheckFunctions } from "./lib/typecheck"; import { oneoffContext } from "./lib/context"; export const typecheck = new Command("typecheck").description( "Run TypeScript typechecking on your Convex functions with `tsc --noEmit`." ).action(async () => { const ctx = oneoffContext; const { configPath, config: localConfig } = await readConfig(ctx, false); await ensureHasConvexDependency(ctx, "typecheck"); const typecheckResult = await typeCheckFunctions( ctx, functionsDir(configPath, localConfig.projectConfig) ); if (typecheckResult === "cantTypeCheck" || typecheckResult === "typecheckFailed") { console.error(chalk.gray("Typecheck failed")); return await ctx.fatalError(1, "fs"); } else { console.error( chalk.green( "Typecheck passed: `tsc --noEmit` completed with exit code 0." ) ); return await ctx.fatalError(0); } }); //# sourceMappingURL=typecheck.js.map