Common front-end components for Web using the Tesseract design system, written for React. https://make.modal.sh/tesseract/web/react/common
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 regels
1.0 KiB

  1. #!/usr/bin/env node
  2. const docgen = require('react-docgen-typescript')
  3. const path = require('path')
  4. const fs = require('fs')
  5. const componentsPath = path.resolve(__dirname, '..', '..', 'react-common', 'src', 'components')
  6. fs.readdir(componentsPath, (err, dir) => {
  7. const trueFilePaths = dir.map(d => path.resolve(__dirname, '..', '..', 'react-common', 'src', 'components', d, `${d}.tsx`))
  8. const docs = docgen.parse(
  9. trueFilePaths,
  10. {
  11. shouldExtractLiteralValuesFromEnum: true,
  12. shouldRemoveUndefinedFromOptional: true,
  13. propFilter: (prop) => {
  14. if (prop.declarations !== undefined && prop.declarations.length > 0) {
  15. const hasPropAdditionalDescription = prop.declarations.find((declaration) => {
  16. return !declaration.fileName.includes("node_modules");
  17. });
  18. return Boolean(hasPropAdditionalDescription);
  19. }
  20. return true;
  21. },
  22. }
  23. )
  24. fs.writeFile(path.resolve(__dirname, '..', 'src', 'docgen.json'), JSON.stringify(docs, null, 2), (err) => {
  25. })
  26. })