create-codeforge-app 1.0.1 → 1.0.3
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 +59 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,16 +8,72 @@
|
|
|
8
8
|
npx create-codeforge-app my-project
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## 新电脑环境准备
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
只需要装两样东西:
|
|
14
|
+
|
|
15
|
+
### 1. 安装 Node.js
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# macOS
|
|
19
|
+
brew install node
|
|
20
|
+
|
|
21
|
+
# Windows
|
|
22
|
+
# 去 https://nodejs.org 下载安装
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. 安装 PostgreSQL(二选一)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 方式A:直接装(推荐)
|
|
29
|
+
# macOS
|
|
30
|
+
brew install postgresql@16
|
|
31
|
+
brew services start postgresql@16 # 启动服务(只需执行一次,开机自动启动)
|
|
32
|
+
|
|
33
|
+
# 方式B:用 Docker
|
|
34
|
+
# macOS
|
|
35
|
+
brew install --cask docker
|
|
36
|
+
# 装完打开 Docker Desktop
|
|
37
|
+
# Windows → 去 https://docker.com 下载安装
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
> 💡 `brew services start` 只需执行一次,之后每次开机 PostgreSQL 会自动启动。如果遇到"PostgreSQL 未启动"的提示,执行 `brew services start postgresql@16` 即可。
|
|
41
|
+
|
|
42
|
+
### 3. 创建项目
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx create-codeforge-app my-shop
|
|
46
|
+
# 回答 4 个问题,等 1-2 分钟,自动完成
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
不需要登录 npm,不需要 clone 仓库,`npx` 自动下载工具并执行。
|
|
15
50
|
|
|
16
51
|
## 功能
|
|
17
52
|
|
|
18
53
|
- 交互式配置(项目名/标题/数据库名)
|
|
19
54
|
- 自动检测 PostgreSQL / Docker 环境
|
|
55
|
+
- macOS brew 安装的 PostgreSQL 自动识别用户名
|
|
20
56
|
- 可选移动端 H5 骨架
|
|
21
57
|
- 可选删除示例模块
|
|
22
58
|
- 自动安装依赖、初始化数据库、写入种子数据
|
|
23
59
|
- 生成随机 JWT_SECRET
|
|
60
|
+
- 清理 git 历史,干净的 init commit
|
|
61
|
+
|
|
62
|
+
## 创建完成后
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cd my-shop
|
|
66
|
+
cd server && npm run start:dev # 后端 http://localhost:3000
|
|
67
|
+
cd client && npm run dev # 前端 http://localhost:5173
|
|
68
|
+
|
|
69
|
+
# 管理员账号: admin@example.com / admin123
|
|
70
|
+
# Swagger 文档: http://localhost:3000/api-docs
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 开发教程
|
|
74
|
+
|
|
75
|
+
项目创建后参考以下文档:
|
|
76
|
+
|
|
77
|
+
- `TUTORIAL.md` — 新增业务模块的完整教程(5 步流程)
|
|
78
|
+
- `DEVELOP.md` — 本地开发环境搭建 + 代码规范
|
|
79
|
+
- `DEPLOY.md` — 部署指南(服务器 / Railway / Cloudflare Pages)
|