Skip to content

Commit 1660df5

Browse files
committed
docs(readme): update
1 parent e2cdebd commit 1660df5

File tree

2 files changed

+377
-142
lines changed

2 files changed

+377
-142
lines changed

README.md

Lines changed: 187 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,229 @@
11
**English** | [简体中文](./README.zh-CN.md)
22

3-
# A Monorepo Component Library Template Project Based on Turbo, Vue3.5+, and TypeScript5+, Helping to Quickly Build Your Own/Enterprise-Level Component Library🚀
3+
<h1 align="center">Vue3 Turbo Component Library Template 🚀</h1>
4+
5+
<p align="center">
6+
快速构建属于你的企业级 Vue 3 组件库,基于最新技术栈的 Monorepo 模板
7+
</p>
8+
9+
<p align="center">
10+
<a href="https://github.com/huangmingfu/vue3-turbo-component-lib-template/stargazers">
11+
<img src="https://img.shields.io/github/stars/huangmingfu/vue3-turbo-component-lib-template" alt="GitHub stars">
12+
</a>
13+
<a href="https://github.com/huangmingfu/vue3-turbo-component-lib-template/issues">
14+
<img src="https://img.shields.io/github/issues/huangmingfu/vue3-turbo-component-lib-template" alt="GitHub issues">
15+
</a>
16+
<a href="https://github.com/huangmingfu/vue3-turbo-component-lib-template/blob/main/LICENSE">
17+
<img src="https://img.shields.io/github/license/huangmingfu/vue3-turbo-component-lib-template" alt="GitHub">
18+
</a>
19+
<a href="https://github.com/huangmingfu/vue3-turbo-component-lib-template/network/members">
20+
<img src="https://img.shields.io/github/forks/huangmingfu/vue3-turbo-component-lib-template" alt="GitHub forks">
21+
</a>
22+
</p>
23+
24+
[![Vue.js](https://img.shields.io/badge/Vue.js-3.5-42b883?style=flat-square&logo=vue.js&logoColor=white)](https://v3.vuejs.org/)
25+
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0-3178c6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
26+
[![Turborepo](https://img.shields.io/badge/Turborepo-%23000000?style=flat-square&logo=turborepo&logoColor=white)](https://turbo.build/)
27+
[![pnpm](https://img.shields.io/badge/pnpm-%23F69220?style=flat-square&logo=pnpm&logoColor=white)](https://pnpm.io/)
28+
[![License](https://img.shields.io/github/license/huangmingfu/vue3-turbo-component-lib-template?style=flat-square)](LICENSE)
29+
30+
A modern component library template based on `Turborepo + Vue 3.5 + TypeScript`, using Monorepo architecture to manage multiple packages with pre-configured code standards and development toolchain. This template helps developers focus on component development without dealing with complicated underlying configurations, quickly building their own enterprise-level component library.
31+
32+
## ✨ Key Features
33+
34+
- 🚀 **Cutting-edge Tech Stack** - Built on Vue 3.5 + TypeScript 5+, enjoy the latest features
35+
- 📦 **Monorepo Architecture** - Managed with Turborepo for multiple packages, improving code reusability
36+
- 🚫 **Enforced pnpm** - Resolves phantom dependencies, saves disk space, improves installation speed
37+
- 🎨 **Complete Standards** - Integrated ESLint, Prettier, Stylelint, Commitlint and other code standards
38+
- 📚 **Documentation Support** - Built with VitePress, supports internationalization
39+
- 🔥 **On-demand Import** - Supports Tree Shaking to reduce final bundle size
40+
- 🎯 **Full Type Support** - Comprehensive TypeScript type definitions for better DX
41+
- 🛠️ **Rich Toolset** - Built-in common Hooks, utility functions and directives
42+
- 🔄 **HMR Support** - Real-time preview during development, boosts productivity
43+
- 🔧 **One-click Renaming** - Quickly replace @mylib with your custom package name
44+
- ⚡️ **Multiple Build Modes** - Supports unified build with Gulp or individual package builds
45+
- 📝 **Version Management** - Uses Changeset for multi-package versioning and release workflow
46+
47+
## 📁 Project Structure
448

5-
This is a modern component library template based on `Turborepo + Vue 3.5 + TypeScript`, using Monorepo architecture to manage multiple packages, covering ESLint, Prettier, Stylelint, Commitlint + Husky + Lint-Staged, and TypeScript project specification configuration. This template provides a complete development environment, aiming to allow developers to focus on component development without worrying about the complexity of underlying configuration, helping to quickly build your own/enterprise-level component library (with detailed step-by-step comments included~).
6-
7-
## ✨ Features
8-
9-
- 📦 Based on Monorepo architecture for better code reuse and version management
10-
- 🚫 Force using pnpm to manage dependencies, solve the problem of ghost dependencies, save disk space, and speed up installation
11-
- 🚀 Using Turbo + Vue 3.5 + TypeScript, enjoy the latest technology features
12-
- 🎨 Integrated complete code specification configuration to ensure code quality
13-
- 📚 Documentation built with VitePress, supporting internationalization
14-
- 🔥 Component library supports on-demand import to reduce bundle size
15-
- 🎯 Complete type hints to improve development experience
16-
- 🛠️ Rich utility functions and Hooks to improve development efficiency
17-
- 🔄 Support hot updates to enhance development experience
18-
- 🔧 Equipped with a one-click package renaming script to replace @mylib with your own package name
19-
- ⚡️ Based on Vite/Rollup to build ESM and CJS products
20-
- ❤️ Equipped with two packaging modes: unified packaging with gulp + rollup or individual package builds with rollup/vite, developers can choose based on their preference
21-
- 📝 Version and release management for multiple packages using changeset
22-
23-
## 📦 Project Structure
49+
```
50+
├── apps/
51+
│ └── docs/ # Component library documentation based on VitePress
52+
├── packages/
53+
│ ├── ui/ # UI component library
54+
│ ├── hooks/ # Custom Hooks
55+
│ ├── directives/ # Custom directives
56+
│ ├── utils/ # Utility functions
57+
│ └── lint-configs/ # Code standard configurations
58+
├── playground/ # Component demo environment
59+
├── build/ # Unified build scripts
60+
└── scripts/ # Helper scripts
61+
```
2462

25-
The project uses Monorepo architecture and mainly contains the following parts:
63+
## 🚀 Quick Start
2664

27-
- `packages/lint-configs`: Contains all configuration-related packages, such as ESLint, Prettier, Stylelint, Commitlint, and TypeScript configurations. These configuration packages ensure code style consistency and high quality.
28-
- `packages/hooks`: Contains all custom Hooks packages.
29-
- `packages/directives`:Contains all directive packages。
30-
- `packages/utils`: Contains all utility function packages.
31-
- `packages/ui`: Contains all UI component packages.
32-
- `apps/docs`: Documentation application, built with Vitepress, providing detailed component library documentation and usage guides.
33-
- `playground`: Playground for testing and demonstrating component examples, built with Vite.
34-
- `build`: Unified packaging script managed by gulp, independent from individual package builds.
65+
```bash
66+
# 1. Clone the template
67+
git clone https://github.com/huangmingfu/vue3-turbo-component-lib-template.git
3568

36-
Additionally, the project includes automated scripts and continuous integration configurations to support efficient development processes and quality assurance.
69+
# 2. Install dependencies
70+
pnpm install
3771

38-
## pkg.json Commands Guide
72+
# 3. Start development environment
73+
pnpm dev
3974

40-
```bash
41-
"dev": "turbo run dev", // Start the development environment for all packages
42-
"dev:docs": "pnpm -F @mylib/docs run dev", // Start the documentation application
43-
"dev:play": "pnpm -F @mylib/playground run dev", // Start the playground
44-
"build": "turbo run build", // Build all packages
45-
"build:docs": "pnpm -F @mylib/docs run build", // Build the documentation application
46-
"build:gulp": "gulp -f build/gulpfile.cjs", // Unified packaging script managed by gulp
47-
"test": "turbo run test", // Run all tests
48-
"test:ui": "pnpm -F @mylib/ui run test:ui", // Run tests for the UI library
49-
"test:coverage": "turbo run test:coverage", // Run tests with coverage
50-
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,mjs,mts,md,vue}\"", // Format all packages' code
51-
"clean": "turbo run clean --continue && rimraf .turbo dist && rm -rf node_modules", // Clean all packages
52-
"deps:update": "pnpm update -r --latest", // Update all packages' dependencies
53-
"deps:check": "pnpm outdated -r", // Check all packages' dependencies
54-
"preinstall": "npx only-allow pnpm", // Ensure pnpm is used to install dependencies
55-
"postinstall": "turbo run build", // Run build after installing dependencies to ensure all packages are built and the project runs successfully
56-
"prepare": "husky install", // Install Husky hooks
57-
"rename-pkg": "bash ./scripts/rename-package.sh", // Rename packages in one go, e.g., @mylib -> @vue3-lib
58-
"generate:component": "node scripts/generate-component.mjs", // Generate new component
75+
# 4. Build the project
76+
pnpm build
5977
```
6078

61-
## 🚀 Quick Start(Demo)
79+
### Install the component library in your project
6280

6381
```bash
64-
# Please replace the following package names with your own. You can use the rename-pkg command to change @mylib to your own package name, for example: pnpm rename-pkg "@mylib" "@vue3-lib"
82+
# Replace @mylib with your own package name
6583
pnpm add @mylib/ui @mylib/utils @mylib/hooks @mylib/directives
6684

67-
# Example installation:
85+
# Example installation
6886
pnpm add @hmflib/ui @hmflib/utils @hmflib/hooks @hmflib/directives
6987
```
7088

71-
### document
89+
## 🧰 Development Commands
90+
91+
```bash
92+
# Development
93+
pnpm dev # Start development environment for all packages
94+
pnpm dev:docs # Start documentation application
95+
pnpm dev:play # Start playground
96+
97+
# Building
98+
pnpm build # Build all packages
99+
pnpm build:docs # Build documentation application
100+
pnpm build:gulp # Unified build with gulp
101+
102+
# Testing
103+
pnpm test # Test all packages
104+
pnpm test:ui # Test UI package
105+
pnpm test:coverage # Test coverage for all packages
106+
107+
# Code Quality
108+
pnpm lint:all # Check all code standards
109+
pnpm deps:check # Check for dependency updates
110+
pnpm deps:update # Update all dependencies
111+
112+
# Others
113+
pnpm clean # Clean build artifacts
114+
pnpm rename-pkg # One-click package renaming
115+
pnpm generate:component # Generate new component
116+
```
72117

73-
> Equipped with international language switching
118+
## 🎯 Why Choose This Template?
119+
120+
### Advantages over other component library templates:
121+
122+
1. **Cutting-edge Technology** - Based on the latest Vue 3.5 and TypeScript 5+, always in sync with technological development
123+
2. **Ready to Use** - Pre-configured complete development toolchain, start developing without additional setup
124+
3. **Flexible Architecture** - Monorepo structure for managing multiple packages while maintaining module independence
125+
4. **Enterprise-grade Standards** - Integrated complete code and commit standards to ensure code quality
126+
5. **Comprehensive Documentation** - Built-in documentation system with internationalization support
127+
6. **Multiple Build Options** - Supports both unified and independent builds to meet different team needs
128+
7. **Easy Customization** - One-click renaming script to quickly customize to your own component library
129+
130+
## 📸 Preview
131+
132+
### Documentation System
133+
134+
> Supports internationalization
74135
75136
![](https://huangmingfu.github.io/drawing-bed/images/pic-go/202412291431548.png)
76137
![](https://huangmingfu.github.io/drawing-bed/images/pic-go/202411271629728.png)
77138
![](https://huangmingfu.github.io/drawing-bed/images/pic-go/202411271629672.png)
78139

79-
### playground
140+
### Playground
141+
142+
> Real-time preview and testing of components
80143
81144
![](https://huangmingfu.github.io/drawing-bed/images/pic-go/202411271630381.png)
82145
![](https://huangmingfu.github.io/drawing-bed/images/pic-go/202411271631563.png)
83146

84-
## Related Links
147+
## 🔧 Tech Stack
148+
149+
- [Vue 3](https://vuejs.org/) - Progressive JavaScript framework
150+
- [TypeScript](https://www.typescriptlang.org/) - Superset of JavaScript with type safety
151+
- [Turborepo](https://turbo.build/repo) - High-performance Monorepo build system
152+
- [VitePress](https://vitepress.dev/) - Vite-powered static site generator
153+
- [Vite](https://vitejs.dev/) - Next-generation frontend build tool
154+
- [pnpm](https://pnpm.io/) - Fast, disk space efficient package manager
155+
- [ESLint](https://eslint.org/) - JavaScript/TypeScript code quality tool
156+
- [Prettier](https://prettier.io/) - Code formatter
157+
- [Stylelint](https://stylelint.io/) - CSS/SCSS/Less code linter
158+
- [Commitlint](https://commitlint.js.org/) - Commit message linting tool
159+
- [husky](https://typicode.github.io/husky/) - Git hooks manager
160+
- [lint-staged](https://github.com/lint-staged/lint-staged) - Run linters on git staged files
161+
- [Changesets](https://github.com/changesets/changesets) - Versioning and release management tool
162+
163+
## 📚 Related Links
85164

86165
> Some code and structure design references [Vben5](https://github.com/vbenjs/vue-vben-admin)
87166
88-
- [Vue 3](https://vuejs.org/)
89-
- [TypeScript](https://www.typescriptlang.org/)
90-
- [Turborepo](https://turbo.build/repo)
91-
- [Vitepress](https://vitepress.dev/)
92-
- [Vite](https://vitejs.dev/)
93-
- [Vben-admin](https://github.com/vbenjs/vue-vben-admin)
167+
- [Vue 3 Official Documentation](https://vuejs.org/)
168+
- [TypeScript Official Documentation](https://www.typescriptlang.org/)
169+
- [Turborepo Official Documentation](https://turbo.build/repo)
170+
- [VitePress Official Documentation](https://vitepress.dev/)
171+
- [Vben Admin](https://github.com/vbenjs/vue-vben-admin)
172+
173+
## ❓ FAQ
94174

95-
## Help Guide
175+
### 1. Why recommend pnpm?
96176

97-
1. If you encounter issues executing `rm -rf` or other `shell` commands, you can run the commands using Git Bash terminal (which comes with Git after installation).
98-
![Run Commands in Git Bash](https://huangmingfu.github.io/drawing-bed/images/pic-go/202412251542234.png)
99-
For commands like `clean`, `rename-pkg`, etc., located in the project root directory, you can use the above method to resolve the issue.
177+
pnpm has the following advantages over npm and yarn:
100178

101-
2. If you encounter failures when running `pnpm run dev`, you need to first execute the build command: `pnpm run build`, and then run `pnpm run dev`.
179+
- Solves phantom and doppelganger dependencies issues
180+
- Saves significant disk space
181+
- Faster installation speed
182+
- Ensures consistent node_modules structure
102183

103-
## Contributing Guide
184+
### 2. How to customize package names?
104185

105-
1. Fork this repository
186+
The project uses `@mylib` as the default package name prefix. You can replace it with one command:
187+
188+
```bash
189+
# Replace @mylib with your custom package name, e.g. @yourname
190+
pnpm rename-pkg "@mylib" "@yourname"
191+
```
192+
193+
### 3. How to generate new components?
194+
195+
Use the built-in script to quickly generate new components:
196+
197+
```bash
198+
pnpm generate:component
199+
```
200+
201+
### 4. What to do if command execution fails?
202+
203+
If you encounter issues executing `rm -rf` or other shell commands, please use Git Bash terminal to run the commands.
204+
![](https://huangmingfu.github.io/drawing-bed/images/pic-go/202412251542234.png)
205+
206+
If `pnpm run dev` fails, first execute the build command:
207+
208+
```bash
209+
pnpm run build
210+
pnpm run dev
211+
```
212+
213+
## 🤝 Contributing
214+
215+
Contributions of any kind are welcome!
216+
217+
1. Fork the repository
106218
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
107219
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
108220
4. Push to the branch (`git push origin feature/AmazingFeature`)
109221
5. Open a Pull Request
110222

111-
## License
223+
## 📄 License
112224

113225
[MIT](LICENSE)
226+
227+
---
228+
229+
⭐ If you like this project, please give it a star! Your support is our motivation for continuous improvement!

0 commit comments

Comments
 (0)