|
- #!/usr/bin/env node
-
- const docgen = require('react-docgen-typescript')
- const path = require('path')
- const fs = require('fs')
-
- const componentsPath = path.resolve(__dirname, '..', '..', 'react-common', 'src', 'components')
-
- fs.readdir(componentsPath, (err, dir) => {
- const trueFilePaths = dir.map(d => path.resolve(__dirname, '..', '..', 'react-common', 'src', 'components', d, `${d}.tsx`))
- const docs = docgen.parse(
- trueFilePaths,
- {
- shouldExtractLiteralValuesFromEnum: true,
- shouldRemoveUndefinedFromOptional: true,
- propFilter: {
- skipPropsWithName: ['key', 'ref'],
- },
- }
- )
- fs.writeFile(path.resolve(__dirname, '..', 'src', 'docgen.json'), JSON.stringify(docs, null, 2), (err) => {
-
- })
- })
|