Skip to content

Commit

Permalink
docs: 完善开发流程文档
Browse files Browse the repository at this point in the history
  • Loading branch information
phy-lei committed Feb 7, 2025
1 parent 3b8a0a4 commit 9cf6fed
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,56 @@
pnpm i
pnpm run dev
```
> 即使修改了组件的代码,也会热更运行打包运行,不用手动build components
> 即使修改了组件的代码,也会热更运行,不用手动build components
# 开发流程
本地页面文档调试地址示例:http://localhost:4321/h5/zh-cn/button
zh-cn为多语言,可根据需要切换,目前支持'en' | 'zh-cn' | 'zh-tw'
需要对照[nutui组件库3.x](https://nutui.jd.com/3x/#/zh-CN/component/button)版本实现翻译对照,对应的翻译代码仓库为[nutui-vue版本](https://github.com/jd-opensource/nutui/tree/v4/src/packages/__VUE),vue版本的代码比起react版本有更新的实现方式,当然也可以对照react版本。在写完组件代码后,还需要额外补充单元测试用例

# 开发目录结构
## 文档官网目录结构
```text
├── nutui-solid-site
│ ├── content
│ │ ├── config.ts
│ │ ├── en // 组件英文文档位置
│ │ │ └── button.mdx
│ │ ├── taro // 组件taro文档位置 重要
│ │ │ └── button.mdx
│ │ ├── zh-cn // 组件中文文档位置 重要
│ │ │ ├── button.mdx
│ │ └── zh-tw // 组件台湾文档位置
│ │ └── button.mdx
│ ├── pages
│ │ ├── demo // 组件demo位置
│ │ │ ├── button.astro
│ │ ├── h5
│ │ │ └── [lang]
│ │ ├── index.astro
│ │ └── taro
│ │ └── [...title].astro
└── tsconfig.json
```
## 组件库目录结构
```text
nutui-solid
├── src
│ ├── components // 开发的组件目录
│ │ ├── button
│ │ │ ├── __test__ // 单元测试目录
│ │ │ ├── button.taro.tsx
│ │ │ ├── button.tsx
│ │ │ ├── demos
│ │ │ ├── index.scss
│ │ │ ├── index.taro.ts
│ │ │ └── index.ts
│ │ ├── nutui.solid.build.ts 全局组件编译入口文件 每次新增组件时,重新编译会自动生成入口文件
│ ├── hooks
│ │ └── create-context.tsx
├── tsconfig.json
├── vite.config.build.css.ts
└── vite.config.ts
```

根目录下的config.json,是组件库的配置文件,用于配置组件库的一些信息,如组件库名称、版本号、作者等信息。在新增组件的时候,这里也需要同步一下。

0 comments on commit 9cf6fed

Please sign in to comment.