Skip to content

Commit f38351b

Browse files
committed
docs: generate special markdown page for Software
1 parent 3b8f901 commit f38351b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

generate-docs.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { globbySync } from 'globby';
33
import path from 'path';
44
import { fileURLToPath } from 'url';
55
import { zod2md } from 'zod2md';
6+
import { convertSchemas, formatModelsAsMarkdown } from 'zod2md';
67

78
const __filename = fileURLToPath(import.meta.url);
89
const __dirname = path.dirname(__filename);
@@ -228,6 +229,24 @@ async function main() {
228229
await fs.writeFile(OUTPUT_FILE, out, 'utf8');
229230
console.log(`Wrote ${OUTPUT_FILE}`);
230231

232+
// Special case: Software Schema (malware + tool)
233+
const sdoIndex = await import(path.join(SCHEMA_DIR, 'sdo/index.ts'));
234+
const { malwareSchema, toolSchema } = sdoIndex;
235+
236+
// Compose models for both schemas
237+
const models = convertSchemas([
238+
{ schema: malwareSchema, path: 'sdo/malware.schema.ts', name: 'Malware' },
239+
{ schema: toolSchema, path: 'sdo/tool.schema.ts', name: 'Tool' },
240+
]);
241+
const softwareMarkdown = formatModelsAsMarkdown(models, {
242+
title: 'Software Schema',
243+
});
244+
245+
const softwareOutputFile = path.join(OUTPUT_DIR, 'sdo', 'software.schema.mdx');
246+
await fs.ensureDir(path.dirname(softwareOutputFile));
247+
await fs.writeFile(softwareOutputFile, softwareMarkdown, 'utf8');
248+
console.log(`Wrote ${softwareOutputFile}`);
249+
231250
// --- Schema file generation ---
232251
const schemaFiles = globbySync(['**/*.schema.ts'], { cwd: SCHEMA_DIR });
233252

0 commit comments

Comments
 (0)