React DocGen TypeScript 使用教程

React DocGen TypeScript 使用教程

react-docgen-typescriptA simple parser for react properties defined in typescript instead of propTypes.项目地址:https://gitcode.com/gh_mirrors/re/react-docgen-typescript

1. 项目的目录结构及介绍

React DocGen TypeScript 是一个用于从 TypeScript 文件中提取组件文档的工具。以下是其主要目录结构及介绍:

react-docgen-typescript/
├── bin/
│   └── react-docgen-typescript
├── lib/
│   ├── parser.d.ts
│   ├── parser.js
│   ├── resolver/
│   │   ├── default.d.ts
│   │   ├── default.js
│   │   ├── findAllComponentDefinitions.d.ts
│   │   ├── findAllComponentDefinitions.js
│   │   ├── findAllExportedComponentDefinitions.d.ts
│   │   ├── findAllExportedComponentDefinitions.js
│   │   └── index.d.ts
│   ├── utils/
│   │   ├── getDocblock.d.ts
│   │   ├── getDocblock.js
│   │   ├── getDoclets.d.ts
│   │   ├── getDoclets.js
│   │   ├── getTypeAnnotation.d.ts
│   │   ├── getTypeAnnotation.js
│   │   ├── index.d.ts
│   │   ├── index.js
│   │   ├── parse.d.ts
│   │   ├── parse.js
│   │   ├── resolveExportDeclaration.d.ts
│   │   └── resolveExportDeclaration.js
│   └── index.d.ts
│   └── index.js
├── src/
│   ├── parser.ts
│   ├── resolver/
│   │   ├── default.ts
│   │   ├── findAllComponentDefinitions.ts
│   │   ├── findAllExportedComponentDefinitions.ts
│   │   └── index.ts
│   ├── utils/
│   │   ├── getDocblock.ts
│   │   ├── getDoclets.ts
│   │   ├── getTypeAnnotation.ts
│   │   ├── index.ts
│   │   ├── parse.ts
│   │   └── resolveExportDeclaration.ts
│   └── index.ts
├── test/
│   ├── parser.test.ts
│   ├── resolver/
│   │   ├── default.test.ts
│   │   ├── findAllComponentDefinitions.test.ts
│   │   ├── findAllExportedComponentDefinitions.test.ts
│   │   └── index.test.ts
│   ├── utils/
│   │   ├── getDocblock.test.ts
│   │   ├── getDoclets.test.ts
│   │   ├── getTypeAnnotation.test.ts
│   │   ├── index.test.ts
│   │   ├── parse.test.ts
│   │   └── resolveExportDeclaration.test.ts
│   └── index.test.ts
├── .gitignore
├── .npmignore
├── .prettierrc
├── CHANGELOG.md
├── LICENSE
├── package.json
├── README.md
├── tsconfig.json
└── yarn.lock

目录结构说明

  • bin/: 包含可执行文件。
  • lib/: 编译后的 JavaScript 文件。
  • src/: 源代码目录,包含 TypeScript 文件。
  • test/: 测试文件目录。
  • .gitignore: Git 忽略文件配置。
  • .npmignore: npm 忽略文件配置。
  • .prettierrc: Prettier 代码格式化配置。
  • CHANGELOG.md: 更新日志。
  • LICENSE: 项目许可证。
  • package.json: 项目依赖和脚本配置。
  • README.md: 项目说明文档。
  • tsconfig.json: TypeScript 编译配置。
  • yarn.lock: Yarn 依赖锁定文件。

2. 项目的启动文件介绍

React DocGen TypeScript 的启动文件位于 bin/ 目录下,名为 react-docgen-typescript。这个文件是一个可执行脚本,用于启动解析过程。

#!/usr/bin/env node

const path = require('path');
const fs = require('fs');
const { parse } = require('../lib/parser');

const filePath = process.argv[2];

if (!filePath) {
  console.error('Please provide a file path.');
  process.exit(1);
}

const resolvedPath = path.resolve(filePath);

if (!fs.

react-docgen-typescriptA simple parser for react properties defined in typescript instead of propTypes.项目地址:https://gitcode.com/gh_mirrors/re/react-docgen-typescript

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

平樱玫Duncan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值