You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/sites/svelte.dev/scripts/generate_examples.js

17 lines
533 B

import { fileURLToPath } from 'node:url';
import { get_examples_data } from '../src/lib/server/examples/index.js';
import { mkdir, writeFile } from 'node:fs/promises';
const examples_data = await get_examples_data(
fileURLToPath(new URL('../../../documentation/examples', import.meta.url))
);
try {
await mkdir(new URL('../src/lib/generated/', import.meta.url), { recursive: true });
} catch {}
writeFile(
new URL('../src/lib/generated/examples-data.js', import.meta.url),
`export default ${JSON.stringify(examples_data)}`
);