create-comate-pagebuilder 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/bin/index.js +41 -0
- package/package.json +33 -0
- package/template/README.md +102 -0
- package/template/index.html +13 -0
- package/template/package-lock.json +2683 -0
- package/template/package.json +30 -0
- package/template/postcss.config.js +6 -0
- package/template/src/App.jsx +11 -0
- package/template/src/components/Card.jsx +42 -0
- package/template/src/components/Hero.jsx +66 -0
- package/template/src/index.css +41 -0
- package/template/src/main.jsx +10 -0
- package/template/src/pages/Home.jsx +56 -0
- package/template/src/utils/cn.js +10 -0
- package/template/tailwind.config.js +74 -0
- package/template/vite.config.js +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# create-comate-pagebuilder
|
|
2
|
+
|
|
3
|
+
Scaffold a React + Vite + Tailwind CSS project with PageBuilder template.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
### Using npm
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create comate-pagebuilder@latest my-app
|
|
11
|
+
cd my-app
|
|
12
|
+
npm install
|
|
13
|
+
npm run dev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Using npx
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx create-comate-pagebuilder@latest my-app
|
|
20
|
+
cd my-app
|
|
21
|
+
npm install
|
|
22
|
+
npm run dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Using Yarn
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn create comate-pagebuilder my-app
|
|
29
|
+
cd my-app
|
|
30
|
+
yarn
|
|
31
|
+
yarn dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Using PNPM
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm create comate-pagebuilder my-app
|
|
38
|
+
cd my-app
|
|
39
|
+
pnpm install
|
|
40
|
+
pnpm dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## What's Included
|
|
44
|
+
|
|
45
|
+
The generated project includes:
|
|
46
|
+
|
|
47
|
+
- **React 18** - Modern React with hooks
|
|
48
|
+
- **Vite** - Fast build tool and dev server
|
|
49
|
+
- **Tailwind CSS** - Utility-first CSS framework
|
|
50
|
+
- **Framer Motion** - Production-ready motion library
|
|
51
|
+
- **Lucide React** - Beautiful & consistent icon set
|
|
52
|
+
- **clsx** & **tailwind-merge** - Utility for constructing className strings
|
|
53
|
+
|
|
54
|
+
### Optional Dependencies
|
|
55
|
+
|
|
56
|
+
- **GSAP** - Professional-grade animation library
|
|
57
|
+
- **Lottie Web** - Render After Effects animations
|
|
58
|
+
- **Animate.css** - Ready-to-use CSS animations
|
|
59
|
+
|
|
60
|
+
## Project Structure
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
my-app/
|
|
64
|
+
├── src/
|
|
65
|
+
│ ├── components/ # React components
|
|
66
|
+
│ ├── pages/ # Page components
|
|
67
|
+
│ ├── utils/ # Utility functions
|
|
68
|
+
│ ├── App.jsx # Main App component
|
|
69
|
+
│ ├── main.jsx # Entry point
|
|
70
|
+
│ └── index.css # Global styles
|
|
71
|
+
├── index.html # HTML template
|
|
72
|
+
├── vite.config.js # Vite configuration
|
|
73
|
+
├── tailwind.config.js # Tailwind configuration
|
|
74
|
+
├── postcss.config.js # PostCSS configuration
|
|
75
|
+
└── package.json # Project dependencies
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Available Scripts
|
|
79
|
+
|
|
80
|
+
In the generated project directory:
|
|
81
|
+
|
|
82
|
+
- `npm run dev` - Start development server
|
|
83
|
+
- `npm run build` - Build for production
|
|
84
|
+
- `npm run preview` - Preview production build
|
|
85
|
+
|
|
86
|
+
## Learn More
|
|
87
|
+
|
|
88
|
+
- [Vite Documentation](https://vitejs.dev/)
|
|
89
|
+
- [React Documentation](https://react.dev/)
|
|
90
|
+
- [Tailwind CSS Documentation](https://tailwindcss.com/)
|
|
91
|
+
- [Framer Motion Documentation](https://www.framer.com/motion/)
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
async function init() {
|
|
7
|
+
try {
|
|
8
|
+
// 获取项目名称(从命令行参数或默认值)
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
const projectName = args[0] || 'my-pagebuilder-app';
|
|
11
|
+
|
|
12
|
+
// 目标目录
|
|
13
|
+
const targetDir = path.join(process.cwd(), projectName);
|
|
14
|
+
|
|
15
|
+
// 检查目标目录是否已存在
|
|
16
|
+
if (fs.existsSync(targetDir)) {
|
|
17
|
+
console.error(`❌ Error: Directory "${projectName}" already exists.`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 模板目录
|
|
22
|
+
const templateDir = path.join(__dirname, '..', 'template');
|
|
23
|
+
|
|
24
|
+
console.log(`\n📦 Creating project: ${projectName}...\n`);
|
|
25
|
+
|
|
26
|
+
// 复制模板文件到目标目录
|
|
27
|
+
await fs.copy(templateDir, targetDir);
|
|
28
|
+
|
|
29
|
+
console.log('✅ Project created successfully!\n');
|
|
30
|
+
console.log('📝 Next steps:\n');
|
|
31
|
+
console.log(` cd ${projectName}`);
|
|
32
|
+
console.log(' npm install');
|
|
33
|
+
console.log(' npm run dev\n');
|
|
34
|
+
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('❌ Error creating project:', error.message);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
init();
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-comate-pagebuilder",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Create a React + Vite + Tailwind CSS project with PageBuilder template",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-comate-pagebuilder": "./bin/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"template"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"create",
|
|
15
|
+
"pagebuilder",
|
|
16
|
+
"react",
|
|
17
|
+
"vite",
|
|
18
|
+
"tailwind",
|
|
19
|
+
"template",
|
|
20
|
+
"scaffold"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "node bin/index.js test-project"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"fs-extra": "^11.2.0"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=14.0.0"
|
|
30
|
+
},
|
|
31
|
+
"author": "",
|
|
32
|
+
"license": "MIT"
|
|
33
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# PageBuilder React Template
|
|
2
|
+
|
|
3
|
+
🎨 **高保真前端原型快速启动模板**
|
|
4
|
+
|
|
5
|
+
这是 PageBuilder 智能体的标准 React + Vite + Tailwind CSS 模板,开箱即用。
|
|
6
|
+
|
|
7
|
+
## ✨ 特性
|
|
8
|
+
|
|
9
|
+
- ⚡️ **Vite** - 极速开发体验
|
|
10
|
+
- ⚛️ **React 18** - 最新 React 特性
|
|
11
|
+
- 🎨 **Tailwind CSS** - 原子化 CSS 框架
|
|
12
|
+
- 🎭 **Framer Motion** - 流畅的动画效果
|
|
13
|
+
- 🎯 **Lucide React** - 现代图标库
|
|
14
|
+
- 📦 **预配置路径别名** - 便捷的模块导入
|
|
15
|
+
- 🎪 **标准配色系统** - Primary / Accent / Neutral
|
|
16
|
+
- 🧩 **示例组件** - Hero / Card 等常用组件
|
|
17
|
+
|
|
18
|
+
## 📦 安装
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 🚀 开发
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm run dev
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
访问 `http://localhost:3000`
|
|
31
|
+
|
|
32
|
+
## 🏗️ 构建
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run build
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 📁 项目结构
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
src/
|
|
42
|
+
├── components/ # 组件目录
|
|
43
|
+
│ ├── Hero.jsx # Hero 组件
|
|
44
|
+
│ └── Card.jsx # 卡片组件
|
|
45
|
+
├── pages/ # 页面目录
|
|
46
|
+
│ └── Home.jsx # 首页
|
|
47
|
+
├── styles/ # 样式目录
|
|
48
|
+
├── utils/ # 工具函数
|
|
49
|
+
│ └── cn.js # className 合并工具
|
|
50
|
+
├── App.jsx # 根组件
|
|
51
|
+
├── main.jsx # 入口文件
|
|
52
|
+
└── index.css # 全局样式
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 🎨 配色系统
|
|
56
|
+
|
|
57
|
+
模板内置三套配色方案:
|
|
58
|
+
|
|
59
|
+
- **Primary** - 主色(蓝色系)
|
|
60
|
+
- **Accent** - 强调色(紫色系)
|
|
61
|
+
- **Neutral** - 中性色(灰色系)
|
|
62
|
+
|
|
63
|
+
在 `tailwind.config.js` 中可自定义。
|
|
64
|
+
|
|
65
|
+
## 📚 可选动效库
|
|
66
|
+
|
|
67
|
+
模板已在 `package.json` 中配置以下可选依赖:
|
|
68
|
+
|
|
69
|
+
- `gsap` - 强大的动画库
|
|
70
|
+
- `lottie-web` - Lottie 动画支持
|
|
71
|
+
- `animate.css` - CSS 动画库
|
|
72
|
+
|
|
73
|
+
根据需要安装:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
npm install gsap lottie-web animate.css
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 🛠️ 路径别名
|
|
80
|
+
|
|
81
|
+
已配置以下路径别名:
|
|
82
|
+
|
|
83
|
+
- `@` → `src/`
|
|
84
|
+
- `@components` → `src/components/`
|
|
85
|
+
- `@pages` → `src/pages/`
|
|
86
|
+
- `@styles` → `src/styles/`
|
|
87
|
+
- `@utils` → `src/utils/`
|
|
88
|
+
|
|
89
|
+
## 📖 使用建议
|
|
90
|
+
|
|
91
|
+
1. **组件命名** - 使用 PascalCase(如 `HeroSection.jsx`)
|
|
92
|
+
2. **样式优先级** - Tailwind > CSS Modules > 全局 CSS
|
|
93
|
+
3. **动效使用** - Framer Motion 用于组件级,GSAP 用于页面级
|
|
94
|
+
4. **响应式设计** - 优先使用 Tailwind 断点(sm/md/lg/xl/2xl)
|
|
95
|
+
|
|
96
|
+
## 📝 License
|
|
97
|
+
|
|
98
|
+
MIT
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
🤖 Generated by **PageBuilder** - 高保真前端原型智能体
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>PageBuilder App</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|