@coreui/astro-docs-api-generator
v0.1.0-beta.2
Published
API documentation JSON generator for @coreui/astro-docs (React + Vue), emitting a consistent ApiData shape.
Maintainers
Readme
@coreui/astro-docs-api-generator
Generates API documentation JSON for @coreui/astro-docs.
It reads your component sources with react-docgen-typescript (React) or
vue-docgen-api (Vue) and emits one <Name>.api.json per component in a
consistent ApiData shape, consumed by the docs engine's <Api> component.
Installation
npm install --save-dev @coreui/astro-docs-api-generatorUsage
Point the CLI at a config module (defaults to api.config.mjs in the current
directory):
coreui-docs-api [path/to/api.config.mjs]api.config.mjs lists the framework and the components to document:
export default {
framework: 'react', // 'react' | 'vue'
outDir: 'src/api', // where the *.api.json files are written
importPackage: '@coreui/react', // shown in the generated import snippet
components: {
CButton: '../coreui-react/src/components/button/CButton.tsx',
CAlert: '../coreui-react/src/components/alert/CAlert.tsx',
},
}Paths are resolved relative to the config file. The React extractor loads
eagerly; the Vue one lazily, so a React-only run never pulls in vue-docgen-api.
