-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add complete list to find missing docgens
- Loading branch information
1 parent
2e81f9f
commit e3161af
Showing
3 changed files
with
37,580 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const fs = require('fs') | ||
const {relative} = require('path') | ||
const globby = require('globby') | ||
const docgen = require('react-docgen-typescript') | ||
const {Table} = require('console-table-printer') | ||
|
||
const componentPaths = globby.sync([ | ||
'../src/**/*.tsx', | ||
'!../src/__tests__', | ||
'!../src/stories', | ||
'!../src/hooks', | ||
'!../src/utils' | ||
]) | ||
|
||
const data = docgen.parse(componentPaths, { | ||
savePropValueAsString: true, | ||
propFilter: prop => { | ||
if (prop.declarations !== undefined && prop.declarations.length > 0) { | ||
const hasPropAdditionalDescription = prop.declarations.find(declaration => { | ||
return !declaration.fileName.includes('node_modules') | ||
}) | ||
return Boolean(hasPropAdditionalDescription) | ||
} | ||
return true | ||
} | ||
}) | ||
|
||
const table = new Table() | ||
componentPaths.forEach(path => { | ||
const doc = data.find(doc => relative(process.cwd(), doc.filePath) === path) | ||
if (path.includes('AvatarStack')) console.log(doc) | ||
|
||
const docs = doc | ||
const props = doc?.props | ||
const displayName = doc?.displayName | ||
|
||
table.addRow( | ||
{path: path.replace('../src/', ''), docs: docs ? '✓' : '✕', props: props ? '✓' : '✕', displayName}, | ||
{color: props ? 'green' : docs ? 'yellow' : 'red'} | ||
) | ||
}) | ||
table.printTable() |
Oops, something went wrong.