@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.
26 lines (19 loc) • 522 B
text/typescript
import path from 'path'
import {_fileExists} from '../_lib/_fileExists'
const CONFIG_FILE_NAMES = [
'tsdoc.config.js',
'tsdoc.config.jsx',
'tsdoc.config.mjs',
'tsdoc.config.cjs',
'tsdoc.config.ts',
'tsdoc.config.tsx',
]
/** @internal */
export function _findConfigFile(options: {packagePath: string}): string | undefined {
const {packagePath} = options
for (const f of CONFIG_FILE_NAMES) {
const file = path.resolve(packagePath, f)
if (_fileExists(file)) return file
}
return undefined
}