forked from h3js/srvx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomd.config.ts
More file actions
46 lines (44 loc) · 1.26 KB
/
automd.config.ts
File metadata and controls
46 lines (44 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { glob } from "node:fs/promises";
import * as md from "mdbox";
import { fileURLToPath } from "node:url";
export default {
input: ["README.md", "docs/**/*.md"],
generators: {
cliUsage: {
async generate(_ctx) {
process.env.NO_COLOR = "1";
const { usage } = await import("./src/cli.js");
delete process.env.NO_COLOR;
const _usage = usage({ command: "srvx", docs: "", issues: "" });
return {
contents: md.codeBlock(_usage, "sh"),
};
},
},
examples: {
async generate(_ctx) {
const examples: string[][] = [];
for await (const dir of glob(
fileURLToPath(new URL("examples/*", import.meta.url)),
)) {
const name = dir.split("/").pop();
if (name === "stackblitz") continue;
examples.push([
`\`${name}\``,
md.link(
`https://github.com/h3js/srvx/tree/main/examples/${name}/`,
`examples/${name}`,
),
`\`npx giget gh:h3js/srvx/examples/${name} srvx-${name}\``,
]);
}
return {
contents: md.table({
columns: ["Example", "Source", "Try"],
rows: examples,
}),
};
},
},
},
};