How ant-design/pro-components works
Project type and purpose
• This is an open-source React UI component library (“@ant-design/pro-components”) built on top of Ant Design.
• It provides enterprise-grade, pre-built components (cards, forms, tables, layouts, etc.), plus tooling for docs (demos, Dumi), automated builds, tests, and publishing.
File structure
• src/
• Organized by feature/module: card, descriptions, field, form, layout, list, provider, skeleton, table, utils.
• Each module contains one or more React components, styles, and types.
• demos/
• Live examples for each component group, used by Dumi to generate interactive docs.
• site/
• Markdown (.md/.mdx) and configuration for the Dumi-powered documentation site.
• scripts/
• Build and release automation (father bundler config, changelog generation, path fixes, publish scripts).
• tests/
• Unit and snapshot tests (Vitest/Jest), organized per module and per demo.
• root-level configs
• tsconfig.json, .eslintrc, .prettierrc, .fatherrc.ts, dumi config (dumirc.ts), CI workflows under .github/workflows.
Architecture overview & main components
• Component Modules (Card, Form, Table, Layout, Field, List, Descriptions, Skeleton, Provider, Utils)
• Build & Bundling (father.js → outputs CommonJS / ES modules)
• Documentation (demos + site folder → Dumi → static site)
• Testing (Vitest/Jest → unit and snapshot reports)
• CI/CD (GitHub Actions → lint, test, coverage, publish)
• Package Registry (npm)
b. Relationships and data flow:
1. Developer commits code →
• Components in src/
• scripts/ orchestrate pre-build tasks (e.g., code path fixes).
2. Build & Bundling
• father reads tsconfig, transpiles TS/JSX → lib/(cjs & es)
3. Testing
• tests run against built or source code → pass/fail
4. Docs Site Generation
• demos + Markdown under site/ + Dumi config → build static docs
5. CI/CD Pipeline
• GitHub Actions run lint → test → coverage → if on main & tagged → publish to npm
6. Consumers
• External apps import from npm registry; consume ES or CJS builds and types
Architectural patterns & design principles
• Modular, feature-based folder structure
• Single-responsibility components (each folder = one component or utility)
• Re-usable utilities & hooks under utils and provider
• Decoupled docs via demos + markdown → maintain examples alongside code
• Automated CI/CD ensures quality and consistent releases
Essential details to capture
• All major src/** modules as separate component-library blocks
• Build pipeline (father config) feeding both dist/ and types/
• Docs pipeline chained from demos + markdown → Dumi
• CI/CD controlling test, coverage, and publish steps
• npm registry as end-point for consumers