Normalize ascii_world demo require paths to relative style
还没有人认领这个 Issue。
评估
调研方向
Start by inspecting the six Lua files under lua-learning-website/public/demos/ascii_world/ and compare their require style with the other demos. Run /demos/ascii_world/main.lua in the editor, then run the existing demos-related e2e tests. Done means the game still supports movement, combat, and NPCs, with no remaining require("demos/...") matches under public/demos/ascii_world/.
由索引模型根据 Issue 内容生成。
描述
Background
In PR #751, `ascii_world` was migrated from `/examples` to `/demos`. Its internal requires used mount-absolute paths (`require("examples/ascii_world/config")`) which were mechanically rewritten to `require("demos/ascii_world/config")`. The reviewer flagged the inconsistency:
`flaming-goat/main.lua` uses relative `require("state")` and `require("rooms.subway")` while ascii_world uses absolute mount-path requires (`require("demos/ascii_world/config")`). [...] verify this is stable if the demo is ever moved, or normalize to absolute requires for consistency.
All other demos (`minesweeper`, `space_shooter`, `flaming-goat`) use the project's prevailing relative require style and have been validated to work via e2e. `ascii_world` is the outlier.
Proposal
Normalize `ascii_world` to relative requires to match the other three demos. This also makes the workspace mount-agnostic — if `/demos` is ever re-mounted or renamed, nothing breaks.
Example:
```lua
-- Before (ascii_world/game.lua)
local config = require("demos/ascii_world/config")
local ui = require("demos/ascii_world/ui")
-- After
local config = require("config")
local ui = require("ui")
```
Files
Six `.lua` files under `lua-learning-website/public/demos/ascii_world/` currently hold mount-absolute requires:
- `main.lua` — `require("demos/ascii_world/game")`
- `game.lua` — 7 internal requires
- `ui.lua` — 1 require
- `combat.lua` — 4 requires
- `maps.lua` — 1 require
- `player.lua` — 2 requires
(`config.lua`, `items.lua`, `monsters.lua` don't need changes.)
Verification
- Manually run `/demos/ascii_world/main.lua` in the editor — game starts, movement/combat/NPCs work
- Existing demos-related e2e tests still pass
- No remaining `require("demos/...")` matches under `public/demos/ascii_world/`
Risk
Low. Lua's require resolver already supports this style — minesweeper, space_shooter, and flaming-goat all rely on it. This is a consistency normalization, not a behavior change.
Deferred from #751 per reviewer feedback.
- 主要语言
- TypeScript
- 星标
- 1
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
jcollard/LuaInTheWeb 的其他 Issue
-
tech-debt
难度 2/5 1-3 小时 新手友好度 88/100
jcollard/LuaInTheWeb#752 ·
-
tech-debt
难度 1/5 1 小时以内 新手友好度 68/100
jcollard/LuaInTheWeb#690 ·
-
tech-debt
难度 1/5 1 小时以内 新手友好度 75/100
jcollard/LuaInTheWeb#590 ·
-
tech-debt
难度 2/5 1-3 小时 新手友好度 62/100
jcollard/LuaInTheWeb#518 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
jcollard/LuaInTheWeb#235 ·
查看 jcollard/LuaInTheWeb 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 72/100
zts212653/clowder-ai#1678 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 64/100
Progressive-Victory/the-website#680 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100