a reactive (signals based) hypermedia web framework (wip) stormlightlabs.github.io/volt/
hypermedia frontend signals
at main 2.5 kB view raw
1/* eslint-disable unicorn/no-process-exit */ 2import { buildCommand } from "$commands/build.js"; 3import { cssDocsCommand } from "$commands/css-docs.js"; 4import { docsCommand } from "$commands/docs.js"; 5import { type BuildMode, exampleCommand } from "$commands/example.js"; 6import { statsCommand } from "$commands/stats.js"; 7import { echo } from "$console/echo.js"; 8import { Command } from "commander"; 9 10const program = new Command(); 11 12program.name("volt").description("CLI tools for Volt.js development").version("0.1.0"); 13 14program.command("docs").description("Generate API documentation from TypeScript doc comments").action(async () => { 15 try { 16 await docsCommand(); 17 } catch (error) { 18 echo.err("Error generating docs:", error); 19 process.exit(1); 20 } 21}); 22 23program.command("stats").description("Display lines of code statistics").option( 24 "--full", 25 "Include test files in the count", 26).action(async (options) => { 27 try { 28 await statsCommand(options.full); 29 } catch (error) { 30 echo.err("Error generating stats:", error); 31 process.exit(1); 32 } 33}); 34 35program.command("build [outDir]").description("Build the library and output to a directory").option( 36 "--no-minify", 37 "Skip minification (outputs volt.js instead of volt.min.js)", 38).option("--no-css", "Skip CSS output").action( 39 async (outDir: string | undefined, options: { minify: boolean; css: boolean }) => { 40 try { 41 await buildCommand(outDir, options); 42 } catch (error) { 43 echo.err("Error building library:", error); 44 process.exit(1); 45 } 46 }, 47); 48 49program.command("css-docs").description("Generate CSS documentation from base.css comments and variables").action( 50 async () => { 51 try { 52 await cssDocsCommand(); 53 } catch (error) { 54 echo.err("Error generating CSS docs:", error); 55 process.exit(1); 56 } 57 }, 58); 59 60const example = program.command("example").description("Manage examples for Volt.js"); 61 62example.command("new <name>").description("Create a new example with scaffolded files").option( 63 "--mode <mode>", 64 "Example mode: markup (declarative) or programmatic (imperative)", 65 "programmatic", 66).option("--standalone", "Create standalone example with local copies of volt.min.js and volt.min.css", false).action( 67 async (name: string, options: { mode: BuildMode; standalone: boolean }) => { 68 try { 69 await exampleCommand(name, options); 70 } catch (error) { 71 echo.err("Error creating example:", error); 72 process.exit(1); 73 } 74 }, 75); 76 77program.parse();