File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,8 +43,10 @@ debug-*.md
4343# 数据文件(历史遗留,不再入库)
4444data /
4545
46- # 构建期生成的 Minecraft 资源(由 scripts/build-atlas.mjs 产出)
47- public /mc /
46+ # 注意:public/mc/ 的图集产物**是入库的**(约 240KB)。
47+ # 它由 scripts/build-atlas.mjs 生成,但生成依赖 sharp + minecraft-assets 两个重包,
48+ # 放进 CI 会让每次自动部署都白装几十 MB。产物本身很小,直接提交更划算。
49+ # 更新 Minecraft 版本时手动跑 `pnpm atlas` 重新生成并提交。
4850public /vendor /mc /
4951app /public /vendor /mc /
5052.playwright-mcp /
Original file line number Diff line number Diff line change @@ -218,13 +218,53 @@ webhook 本地收不到(Prism 打不到 localhost),留到线上验。
218218
219219## 五、建表与部署
220220
221+ ### 5.1 建表(** 必须手动,自动部署不会做** )
222+
221223``` bash
224+ pnpm install
222225pnpm db:migrate:remote
223- pnpm deploy
224226```
225227
228+ 在本地跑,通过 wrangler 连远程 D1。** Cloudflare 的 Git 自动部署只做构建与发布,
229+ 不会执行数据库迁移** —— 漏了这步部署照样成功,但接口一碰数据库就 500,
230+ ` /api/_ping ` 会返回 ` dbError: true ` 。
231+
232+ 以后每次新增 migration 文件,合并后也都要手动跑一次。
233+
226234不需要迁移旧数据 —— 旧库已放弃,空库起步。
227235
236+ ### 5.2 部署
237+
238+ ** 方式 A:GitHub + Cloudflare 自动部署(当前采用)**
239+
240+ Dashboard → Workers → 该 Worker → Settings → Build:
241+
242+ | 项 | 值 |
243+ | ---| ---|
244+ | Git repository | ` New-Sim-U-Kraft/homepage ` |
245+ | Branch | ` refactor/homepage ` (正式切换后改 ` main ` ) |
246+ | Build command | ` pnpm build ` |
247+ | Deploy command | ` npx wrangler deploy ` |
248+ | Root directory | 留空 |
249+
250+ 仓库有 ` pnpm-lock.yaml ` 与 ` packageManager ` 字段,Cloudflare 会自动选用 pnpm。
251+
252+ 两点需要知道:
253+
254+ - ** 纹理图集是入库的** (` public/mc/ ` ,约 240KB)。生成它需要 ` sharp ` +
255+ ` minecraft-assets ` 两个重包,放进 CI 会让每次部署白装几十 MB,而产物本身很小。
256+ 所以 ` pnpm build ` ** 不生成图集** ,只在更新 Minecraft 版本时手动
257+ ` pnpm atlas ` 并提交产物。
258+ - secret 独立存储,不随部署更新;` [vars] ` 则跟着 ` wrangler.toml ` 一起生效。
259+
260+ ** 方式 B:本地手动部署**
261+
262+ ``` bash
263+ pnpm deploy
264+ ```
265+
266+ 两种方式可混用,同一个 Worker。
267+
228268### 第一个管理员
229269
230270角色由 Prism 身份组决定,官网没有提权入口,所以** 第一个管理员必须在 Prism 侧
Original file line number Diff line number Diff line change 99 },
1010 "scripts" : {
1111 "dev" : " nuxt dev" ,
12- "build" : " node scripts/build-atlas.mjs && nuxt build" ,
12+ "build" : " nuxt build" ,
1313 "preview" : " wrangler dev" ,
1414 "deploy" : " pnpm build && wrangler deploy" ,
1515 "atlas" : " node scripts/build-atlas.mjs" ,
1616 "gen:key" : " node scripts/gen-license-key.mjs" ,
17- "postinstall" : " nuxt prepare && node scripts/build-atlas.mjs " ,
17+ "postinstall" : " nuxt prepare" ,
1818 "typecheck" : " nuxt typecheck" ,
1919 "lint" : " eslint ." ,
2020 "lint:fix" : " eslint . --fix" ,
Load diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments