Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Normalize ascii_world demo require paths to relative style

未关闭
#754 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
76/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
冷清
技术栈
lua
领域
game-dev

调研方向

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 内容生成。

描述

tech-debt

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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jcollard/LuaInTheWeb 的其他 Issue

查看 jcollard/LuaInTheWeb 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。