-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathknowledge.mjs
More file actions
19 lines (18 loc) · 712 Bytes
/
Copy pathknowledge.mjs
File metadata and controls
19 lines (18 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { readFileSync, writeFileSync } from 'node:fs';
import { guideMarkdown, knowledgeGuides } from '../packages/knowledge/src/index.ts';
const path = new URL('../packages/knowledge/catalog.json', import.meta.url);
const data = `${JSON.stringify(
knowledgeGuides.map((guide) => ({
slug: guide.slug,
title: guide.title,
description: guide.description,
url: `https://jackalope.dev/knowledge/${guide.slug}/`,
markdown: guideMarkdown(guide, 'https://jackalope.dev'),
})),
null,
2,
)}\n`;
if (process.argv.includes('--check')) {
if (readFileSync(path, 'utf8') !== data)
throw new Error('Run node scripts/knowledge.mjs to refresh bundled help.');
} else writeFileSync(path, data);