add readme
This commit is contained in:
parent
5848b471ec
commit
0a6fb0e954
4 changed files with 67 additions and 7 deletions
10
index.ts
10
index.ts
|
|
@ -1,3 +1,4 @@
|
|||
import { z } from "zod";
|
||||
import { renderMermaidSVG } from "beautiful-mermaid";
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
|
@ -8,7 +9,10 @@ if (args.length < 2) {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
const [inputPath, outputPath] = args;
|
||||
const argsSchema = z.tuple([z.string(), z.string()]);
|
||||
|
||||
const parsed = argsSchema.parse(args);
|
||||
const [inputPath, outputPath] = parsed;
|
||||
|
||||
try {
|
||||
// Read the .mmd file
|
||||
|
|
@ -25,7 +29,9 @@ try {
|
|||
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
||||
console.error(`✗ Input file not found: ${inputPath}`);
|
||||
} else {
|
||||
console.error(`✗ Error: ${error instanceof Error ? error.message : String(error)}`);
|
||||
console.error(
|
||||
`✗ Error: ${error instanceof Error ? error.message : String(error)}`,
|
||||
);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue