The upper part is the English version, and the lower part is the Chinese version, with the same content. If there are any wrong, or you have anything hard to understand, pls feel free to let me know.many thx.
AntDesign is an enterprise-class UI design language and React UI library, Similar to it is Material-UI or Element React
This article is based on AntDesign 4.23.2
At the top is its basic architecture diagram, which will be analyzed layer by layer below
AntDesign official websiteAntDesign source code
There is planning to choose a few typical components to source code analysis in subsequent articles
4 Compile && Compiled components
Compile with commands in package.json
"compile": "npm run clean && antd-tools run compile"
Can be found from package-lock.json, antd-tools actually corresponds to node_modules/@ant-design/tools/lib/cli/index.js
As below is the specific exploration for the compilation process
Find the package corresponding to antd-tools by package-lock.json
Test configuration, such as setting enzyme, mock, etc.
jest configuration file
There are unit tests and snapshot tests in each component directory
7 Code formatting
Formatting codes by eslint+prettier, and execute husky checking before submitting
For details, you can check 9. Pre Commit in my other blog post Design a web architecture based on React18+Mobx `
8 CI/CD
Public component libraries, such as AntDesign, Element-react, will be published to npmjs, their source code will be hosted on github, and be publicly available for download and use
But the internal component library of the enterprise usually use jFrog + gitlab, which requires authentication to access
Travis CI is a CI/CD platform with integrating github. Enterprises usually use gitlab CI/CD or the more powerful jekins.
The following is the Chinese version, the same content as above
AntDesign is an enterprise-class UI design language and React UI library, 与它类似的还有 Material-UI 或 Element React
本文基于 AntDesign 4.23.2
最顶上的是它的基础架构图,会在下面逐层进行分析
AntDesign 官网AntDesign 源码
This article written together by me and Cherry
The upper part is the English version, and the lower part is the Chinese version, with the same content. If there are any wrong, or you have anything hard to understand, pls feel free to let me know.many thx.
1 Directory
2 Tech stack
3 Component source code
4 Compile && Compiled components
Find the package corresponding to antd-tools by package-lock.json![ant-tooles_0](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/20221008080457.png)
Compiling by gulpfile![ant-tools_2](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/64C9371B-01C4-49B2-ADF0-38D71C591593.png)
Compile to ES6/ES5 modular code by gulpfile![compile_1](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/EBBFFD1B-D6E2-4A7A-8444-C076B3C09BA6.png)
Compile into bundle by webpack![compile_2](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/5962F8F8-5C47-4CD2-8A92-628CCEB51F2A.png)
Compiled component![compoile_3](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/D77F16F5-872C-44E5-8004-3B6D35143FD0.png)
5 Document
5.1 AntDesign Document Library
bisheng codes![bisheng_1](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/EF9EED7B-0C2D-45F0-B40D-B9D6FB29DE5A.png)
bisheng effect![bisheng_3](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/25760A77-0053-4FCB-993B-2306B3C8D1F1.png)
5.1 Story Document Library
Microsoft Fluent Component Library storybook effect
Microsoft VSCode Webview UI Toolkit![microsoft_2](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/20221008103849.png)
6 Test
Test command![test_command](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/642A2B2C-56EF-4F4C-B408-2367A49173B5.png)
Test configuration, such as setting enzyme, mock, etc.![test_set](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/A728E540-A490-48DD-A636-83EF99DC9F4C.png)
jest configuration file![jest_config](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/4FA70EBD-6185-482D-A95A-28FB6F868AC2.png)
There are unit tests and snapshot tests in each component directory![snap_test](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/C1C4550D-ED4D-439B-BA7B-252E52A4B946.png)
7 Code formatting
Formatting codes by eslint+prettier, and execute husky checking before submitting For details, you can check
9. Pre Commit
in my other blog post Design a web architecture based on React18+Mobx `8 CI/CD
The following is the Chinese version, the same content as above
1 目录
2 技术栈
3 组件源码
4 编译 && 编译后的组件
通过package-lock.json 找 antd-tools 对应的 package![ant-tooles_0](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/20221008080457.png)
通过gulpfile进行编译![ant-tools_2](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/64C9371B-01C4-49B2-ADF0-38D71C591593.png)
编译成 ES6/ES5 模块化代码![compile_1](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/EBBFFD1B-D6E2-4A7A-8444-C076B3C09BA6.png)
编译成bundle![compile_2](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/5962F8F8-5C47-4CD2-8A92-628CCEB51F2A.png)
编译后的组件![compoile_3](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/D77F16F5-872C-44E5-8004-3B6D35143FD0.png)
5 文档
5.1 AntDesign 文档库
bisheng 代码![bisheng_1](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/EF9EED7B-0C2D-45F0-B40D-B9D6FB29DE5A.png)
bisheng 效果![bisheng_3](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/25760A77-0053-4FCB-993B-2306B3C8D1F1.png)
5.1 Story 文档库
微软 Fluent 组件库 storybook 效果
微软Microsoft VSCode Webview UI Toolkit![microsoft_2](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/20221008103849.png)
6 测试
测试命令![test_command](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/642A2B2C-56EF-4F4C-B408-2367A49173B5.png)
测试的配置,例如设置enzyme,mock等![test_set](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/A728E540-A490-48DD-A636-83EF99DC9F4C.png)
jest配置文件![jest_config](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/4FA70EBD-6185-482D-A95A-28FB6F868AC2.png)
每个组件下都有单元测试和快照测试![snap_test](https://raw.githubusercontent.com/mominger/MyPublicFiles/master/img/C1C4550D-ED4D-439B-BA7B-252E52A4B946.png)
7 代码格式化
通过eslint+prettier进行格式化,以及husky在提交前做检查 具体可以查看我的另一篇博文 Design a web architecture based on React18+Mobx里的
9. Pre Commit
8 CI/CD