create-comate-pagebuilder 1.0.0 → 1.0.1
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 +5 -2
- package/bin/index.js +39 -5
- package/package.json +5 -3
- package/template/README.md +4 -12
- package/template/package.json +1 -1
- package/template/src/components/.gitkeep +0 -0
- package/template/src/index.css +0 -6
- package/template/src/pages/Home.jsx +9 -50
- package/template/vite.config.js +1 -1
- package/template/src/components/Card.jsx +0 -42
- package/template/src/components/Hero.jsx +0 -66
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# create-comate-pagebuilder
|
|
2
2
|
|
|
3
|
-
Scaffold a React + Vite + Tailwind CSS project with
|
|
3
|
+
Scaffold a React + Vite + Tailwind CSS project with a modern, minimalist template.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -46,13 +46,16 @@ The generated project includes:
|
|
|
46
46
|
|
|
47
47
|
- **React 18** - Modern React with hooks
|
|
48
48
|
- **Vite** - Fast build tool and dev server
|
|
49
|
-
- **Tailwind CSS** - Utility-first CSS framework
|
|
49
|
+
- **Tailwind CSS** - Utility-first CSS framework with custom color system
|
|
50
50
|
- **Framer Motion** - Production-ready motion library
|
|
51
51
|
- **Lucide React** - Beautiful & consistent icon set
|
|
52
52
|
- **clsx** & **tailwind-merge** - Utility for constructing className strings
|
|
53
|
+
- **Path aliases** - Pre-configured for clean imports
|
|
53
54
|
|
|
54
55
|
### Optional Dependencies
|
|
55
56
|
|
|
57
|
+
Add these as needed:
|
|
58
|
+
|
|
56
59
|
- **GSAP** - Professional-grade animation library
|
|
57
60
|
- **Lottie Web** - Render After Effects animations
|
|
58
61
|
- **Animate.css** - Ready-to-use CSS animations
|
package/bin/index.js
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs-extra');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 安装依赖
|
|
9
|
+
*/
|
|
10
|
+
function installDependencies(projectDir) {
|
|
11
|
+
console.log('\n📦 Installing dependencies with npm...\n');
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
// 使用 cwd 参数进入项目目录,然后执行 npm install
|
|
15
|
+
execSync('npm install', {
|
|
16
|
+
cwd: projectDir, // 相当于先 cd 到项目目录
|
|
17
|
+
stdio: 'inherit', // 显示安装过程输出
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return true;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error(`\n❌ Failed to install dependencies: ${error.message}`);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
5
26
|
|
|
6
27
|
async function init() {
|
|
7
28
|
try {
|
|
@@ -26,11 +47,24 @@ async function init() {
|
|
|
26
47
|
// 复制模板文件到目标目录
|
|
27
48
|
await fs.copy(templateDir, targetDir);
|
|
28
49
|
|
|
29
|
-
console.log('✅ Project created successfully!\n');
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
console.log('✅ Project files created successfully!\n');
|
|
51
|
+
|
|
52
|
+
// 自动安装依赖
|
|
53
|
+
const installSuccess = installDependencies(targetDir);
|
|
54
|
+
|
|
55
|
+
if (installSuccess) {
|
|
56
|
+
console.log('\n✅ Dependencies installed successfully!\n');
|
|
57
|
+
console.log('🎉 All done! Your project is ready.\n');
|
|
58
|
+
console.log('📝 Next steps:\n');
|
|
59
|
+
console.log(` cd ${projectName}`);
|
|
60
|
+
console.log(' npm run dev\n');
|
|
61
|
+
} else {
|
|
62
|
+
console.log('\n⚠️ Project created but dependencies installation failed.');
|
|
63
|
+
console.log('📝 Please install dependencies manually:\n');
|
|
64
|
+
console.log(` cd ${projectName}`);
|
|
65
|
+
console.log(' npm install');
|
|
66
|
+
console.log(' npm run dev\n');
|
|
67
|
+
}
|
|
34
68
|
|
|
35
69
|
} catch (error) {
|
|
36
70
|
console.error('❌ Error creating project:', error.message);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-comate-pagebuilder",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Create a React + Vite + Tailwind CSS project
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Create a modern, minimalist React + Vite + Tailwind CSS project",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-comate-pagebuilder": "./bin/index.js"
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"vite",
|
|
18
18
|
"tailwind",
|
|
19
19
|
"template",
|
|
20
|
-
"scaffold"
|
|
20
|
+
"scaffold",
|
|
21
|
+
"minimalist",
|
|
22
|
+
"modern"
|
|
21
23
|
],
|
|
22
24
|
"scripts": {
|
|
23
25
|
"test": "node bin/index.js test-project"
|
package/template/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React + Vite + Tailwind CSS Template
|
|
2
2
|
|
|
3
|
-
🎨
|
|
3
|
+
🎨 **现代化前端开发模板**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
这是一个精简的 React + Vite + Tailwind CSS 模板,开箱即用,提供了基础的开发环境配置。
|
|
6
6
|
|
|
7
7
|
## ✨ 特性
|
|
8
8
|
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
- 🎯 **Lucide React** - 现代图标库
|
|
14
14
|
- 📦 **预配置路径别名** - 便捷的模块导入
|
|
15
15
|
- 🎪 **标准配色系统** - Primary / Accent / Neutral
|
|
16
|
-
- 🧩 **示例组件** - Hero / Card 等常用组件
|
|
17
16
|
|
|
18
17
|
## 📦 安装
|
|
19
18
|
|
|
@@ -40,11 +39,8 @@ npm run build
|
|
|
40
39
|
```
|
|
41
40
|
src/
|
|
42
41
|
├── components/ # 组件目录
|
|
43
|
-
│ ├── Hero.jsx # Hero 组件
|
|
44
|
-
│ └── Card.jsx # 卡片组件
|
|
45
42
|
├── pages/ # 页面目录
|
|
46
43
|
│ └── Home.jsx # 首页
|
|
47
|
-
├── styles/ # 样式目录
|
|
48
44
|
├── utils/ # 工具函数
|
|
49
45
|
│ └── cn.js # className 合并工具
|
|
50
46
|
├── App.jsx # 根组件
|
|
@@ -88,7 +84,7 @@ npm install gsap lottie-web animate.css
|
|
|
88
84
|
|
|
89
85
|
## 📖 使用建议
|
|
90
86
|
|
|
91
|
-
1. **组件命名** - 使用 PascalCase(如 `
|
|
87
|
+
1. **组件命名** - 使用 PascalCase(如 `Button.jsx`)
|
|
92
88
|
2. **样式优先级** - Tailwind > CSS Modules > 全局 CSS
|
|
93
89
|
3. **动效使用** - Framer Motion 用于组件级,GSAP 用于页面级
|
|
94
90
|
4. **响应式设计** - 优先使用 Tailwind 断点(sm/md/lg/xl/2xl)
|
|
@@ -96,7 +92,3 @@ npm install gsap lottie-web animate.css
|
|
|
96
92
|
## 📝 License
|
|
97
93
|
|
|
98
94
|
MIT
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
🤖 Generated by **PageBuilder** - 高保真前端原型智能体
|
package/template/package.json
CHANGED
|
File without changes
|
package/template/src/index.css
CHANGED
|
@@ -29,12 +29,6 @@
|
|
|
29
29
|
@apply px-6 py-3 bg-neutral-100 text-neutral-900 rounded-lg font-medium
|
|
30
30
|
hover:bg-neutral-200 active:scale-95 transition-all duration-200;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
/* 标准卡片样式 */
|
|
34
|
-
.card {
|
|
35
|
-
@apply bg-white rounded-xl border border-neutral-200 p-6
|
|
36
|
-
shadow-sm hover:shadow-md transition-shadow duration-300;
|
|
37
|
-
}
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
/* 可选:引入 animate.css(如果使用) */
|
|
@@ -1,56 +1,15 @@
|
|
|
1
|
-
import Hero from '@components/Hero'
|
|
2
|
-
import Card from '@components/Card'
|
|
3
|
-
import { Palette, Zap, Layout } from 'lucide-react'
|
|
4
1
|
|
|
5
2
|
export default function Home() {
|
|
6
|
-
const features = [
|
|
7
|
-
{
|
|
8
|
-
icon: Palette,
|
|
9
|
-
title: "智能配色",
|
|
10
|
-
description: "自动生成符合设计规范的配色方案,支持多种风格"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
icon: Zap,
|
|
14
|
-
title: "丰富动效",
|
|
15
|
-
description: "集成 GSAP、Framer Motion 等主流动效库"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
icon: Layout,
|
|
19
|
-
title: "响应式布局",
|
|
20
|
-
description: "基于 Tailwind CSS 的现代响应式设计系统"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
|
|
24
3
|
return (
|
|
25
|
-
<main>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{/* Features 区域 */}
|
|
35
|
-
<section className="max-w-7xl mx-auto px-6 py-20">
|
|
36
|
-
<div className="text-center mb-16">
|
|
37
|
-
<h2 className="text-4xl font-bold mb-4">核心特性</h2>
|
|
38
|
-
<p className="text-xl text-neutral-600">
|
|
39
|
-
开箱即用的现代前端开发体验
|
|
40
|
-
</p>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div className="grid md:grid-cols-3 gap-8">
|
|
44
|
-
{features.map((feature, index) => (
|
|
45
|
-
<Card
|
|
46
|
-
key={index}
|
|
47
|
-
icon={feature.icon}
|
|
48
|
-
title={feature.title}
|
|
49
|
-
description={feature.description}
|
|
50
|
-
/>
|
|
51
|
-
))}
|
|
52
|
-
</div>
|
|
53
|
-
</section>
|
|
4
|
+
<main className="min-h-screen flex items-center justify-center px-6 py-20">
|
|
5
|
+
<div className="max-w-4xl mx-auto text-center">
|
|
6
|
+
<h1 className="text-6xl font-bold mb-6">
|
|
7
|
+
Welcome
|
|
8
|
+
</h1>
|
|
9
|
+
<p className="text-xl text-neutral-600">
|
|
10
|
+
Start building your application here
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
54
13
|
</main>
|
|
55
14
|
)
|
|
56
15
|
}
|
package/template/vite.config.js
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { motion } from 'framer-motion'
|
|
2
|
-
import { cn } from '@/utils/cn'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* PageBuilder 标准卡片组件
|
|
6
|
-
* 支持 hover 动效、自定义样式
|
|
7
|
-
*/
|
|
8
|
-
export default function Card({
|
|
9
|
-
title,
|
|
10
|
-
description,
|
|
11
|
-
icon: Icon,
|
|
12
|
-
className,
|
|
13
|
-
children
|
|
14
|
-
}) {
|
|
15
|
-
return (
|
|
16
|
-
<motion.div
|
|
17
|
-
className={cn("card group cursor-pointer", className)}
|
|
18
|
-
whileHover={{ y: -4 }}
|
|
19
|
-
transition={{ duration: 0.3 }}
|
|
20
|
-
>
|
|
21
|
-
{Icon && (
|
|
22
|
-
<div className="w-12 h-12 rounded-lg bg-primary-100 flex items-center justify-center mb-4 group-hover:bg-primary-200 transition-colors">
|
|
23
|
-
<Icon className="w-6 h-6 text-primary-600" />
|
|
24
|
-
</div>
|
|
25
|
-
)}
|
|
26
|
-
|
|
27
|
-
{title && (
|
|
28
|
-
<h3 className="text-xl font-semibold mb-2 text-neutral-900">
|
|
29
|
-
{title}
|
|
30
|
-
</h3>
|
|
31
|
-
)}
|
|
32
|
-
|
|
33
|
-
{description && (
|
|
34
|
-
<p className="text-neutral-600 leading-relaxed">
|
|
35
|
-
{description}
|
|
36
|
-
</p>
|
|
37
|
-
)}
|
|
38
|
-
|
|
39
|
-
{children}
|
|
40
|
-
</motion.div>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { motion } from 'framer-motion'
|
|
2
|
-
import { ArrowRight } from 'lucide-react'
|
|
3
|
-
import { cn } from '@/utils/cn'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* PageBuilder 标准 Hero 组件
|
|
7
|
-
* 支持动效、响应式、高保真视觉
|
|
8
|
-
*/
|
|
9
|
-
export default function Hero({
|
|
10
|
-
title = "欢迎来到 PageBuilder",
|
|
11
|
-
subtitle = "高保真前端原型智能体",
|
|
12
|
-
ctaText = "开始使用",
|
|
13
|
-
onCtaClick = () => {}
|
|
14
|
-
}) {
|
|
15
|
-
return (
|
|
16
|
-
<section className="relative min-h-screen flex items-center justify-center px-6 py-20 overflow-hidden">
|
|
17
|
-
{/* 背景装饰 */}
|
|
18
|
-
<div className="absolute inset-0 -z-10">
|
|
19
|
-
<div className="absolute top-20 left-10 w-72 h-72 bg-primary-500/20 rounded-full blur-3xl" />
|
|
20
|
-
<div className="absolute bottom-20 right-10 w-96 h-96 bg-accent-500/20 rounded-full blur-3xl" />
|
|
21
|
-
</div>
|
|
22
|
-
|
|
23
|
-
<div className="max-w-4xl mx-auto text-center">
|
|
24
|
-
{/* 标题 */}
|
|
25
|
-
<motion.h1
|
|
26
|
-
className="text-6xl md:text-7xl lg:text-8xl font-bold mb-6 bg-gradient-to-br from-neutral-900 via-neutral-800 to-neutral-600 bg-clip-text text-transparent"
|
|
27
|
-
initial={{ opacity: 0, y: 20 }}
|
|
28
|
-
animate={{ opacity: 1, y: 0 }}
|
|
29
|
-
transition={{ duration: 0.8, ease: "easeOut" }}
|
|
30
|
-
>
|
|
31
|
-
{title}
|
|
32
|
-
</motion.h1>
|
|
33
|
-
|
|
34
|
-
{/* 副标题 */}
|
|
35
|
-
<motion.p
|
|
36
|
-
className="text-xl md:text-2xl text-neutral-600 mb-12 max-w-2xl mx-auto"
|
|
37
|
-
initial={{ opacity: 0, y: 20 }}
|
|
38
|
-
animate={{ opacity: 1, y: 0 }}
|
|
39
|
-
transition={{ duration: 0.8, delay: 0.2, ease: "easeOut" }}
|
|
40
|
-
>
|
|
41
|
-
{subtitle}
|
|
42
|
-
</motion.p>
|
|
43
|
-
|
|
44
|
-
{/* CTA 按钮 */}
|
|
45
|
-
<motion.button
|
|
46
|
-
onClick={onCtaClick}
|
|
47
|
-
className={cn(
|
|
48
|
-
"group inline-flex items-center gap-2 px-8 py-4",
|
|
49
|
-
"bg-primary-600 hover:bg-primary-700",
|
|
50
|
-
"text-white font-semibold rounded-full",
|
|
51
|
-
"shadow-lg hover:shadow-xl",
|
|
52
|
-
"transition-all duration-300"
|
|
53
|
-
)}
|
|
54
|
-
initial={{ opacity: 0, y: 20 }}
|
|
55
|
-
animate={{ opacity: 1, y: 0 }}
|
|
56
|
-
transition={{ duration: 0.8, delay: 0.4, ease: "easeOut" }}
|
|
57
|
-
whileHover={{ scale: 1.05 }}
|
|
58
|
-
whileTap={{ scale: 0.95 }}
|
|
59
|
-
>
|
|
60
|
-
{ctaText}
|
|
61
|
-
<ArrowRight className="w-5 h-5 group-hover:translate-x-1 transition-transform" />
|
|
62
|
-
</motion.button>
|
|
63
|
-
</div>
|
|
64
|
-
</section>
|
|
65
|
-
)
|
|
66
|
-
}
|