UNPKG

@sanity/tsdoc

Version:

Generate API reference docs from TypeScript projects and store in a Sanity-friendly JSON format. Render a static frontend, or as React components.

16 lines (12 loc) 505 B
import {writeFile} from 'fs/promises' import path from 'path' const SCRIPT = `import {mount} from '@sanity/tsdoc/react' mount({ docs: window.__INITIAL_STATE__ ? window.__INITIAL_STATE__.docs : undefined, element: document.getElementById('root'), releaseVersion: window.__INITIAL_STATE__ ? window.__INITIAL_STATE__.releaseVersion : undefined, }) ` export async function _writeScript(options: {outDir: string}): Promise<void> { await writeFile(path.resolve(options.outDir, 'main.tsx'), SCRIPT) }