Make the device scripts answer --help and refuse bad flags
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 90/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js
调研方向
先查看 scripts/devices/validate.test.mjs 和 scripts/devices/table.test.mjs 中的 CLI 测试,然后阅读每个脚本头部注释中的用法说明行及其 main() 函数。添加对帮助、未知 flag 和缺少值的测试,并使用临时文档文件检查无效的表格参数不会更改该文件。运行 node --test scripts/devices/*.test.mjs,并确认 validate.mjs 仍接受工作流的 --event、--github-output 和 --comment 参数。
由索引模型根据 Issue 内容生成。
描述
Why
docs/devices.md tells people to check a report with node scripts/devices/validate.mjs report.json, but --help makes that script try to open a file named --help, and table.mjs rewrites docs/devices.md when given a flag it doesn't know. ROADMAP.md, Now: the Device lab.
What to do
Today:
node scripts/devices/validate.mjs --helpprintsENOENT: no such file or directory, open '--help'.node scripts/devices/table.mjsignores flags it doesn't know, so--helpor a typo like--chekrewrites docs/devices.md instead of checking it, and--datawith no folder after it writes a table with no reports.
- Test first, in
scripts/devices/validate.test.mjsandscripts/devices/table.test.mjs, which already run the scripts withexecFileSync:--helpand-hprint the usage and exit 0, for both scripts;table.mjswith an unknown flag, or with--dataor--docand no value after it, prints the usage, exits 1 and leaves the doc unchanged. Use a temporary doc file, as the existing CLI test does.
- In each script's
main(), handle--helpand-hfirst, then refuse unknown arguments and flags with no value. Reuse the usage lines from each file's header comment.
Done when
- The new tests pass, and every existing test in
scripts/devices/still passes. validate.mjsbehaves exactly as before when called the way.github/workflows/device-report.ymlcalls it:--event,--github-outputand--comment.
How to check
node --test scripts/devices/*.test.mjs
node scripts/devices/validate.mjs --help
node scripts/devices/table.mjs --check
Keep in mind
validate.mjsruns on public issues. It reads the issue as data and runs nothing from it. Keep it that way, and never print a report's values in an error.- Don't run
node scripts/devices/table.mjswithout--checkon your branch unless you mean to rewrite the table. - Node built-ins only. No new dependency.
- 主要语言
- TypeScript
- 星标
- 11
- 派生
- 0
- 平均合并
- 10 分钟
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DojoCodingLabs/hermit 的其他 Issue
-
docs good first issue
难度 2/5 1-3 小时 新手友好度 87/100
DojoCodingLabs/hermit#73 ·
维护者通常 1 天内回复
-
device-lab
难度 2/5 1-3 小时 新手友好度 70/100
DojoCodingLabs/hermit#45 ·
维护者通常 1 天内回复
-
device-lab
难度 2/5 1-3 小时 新手友好度 62/100
DojoCodingLabs/hermit#44 ·
维护者通常 1 天内回复
-
device-lab
难度 2/5 1-3 小时 新手友好度 72/100
DojoCodingLabs/hermit#43 ·
维护者通常 1 天内回复
-
agent-friendly docs good first issue
难度 2/5 1-3 小时 新手友好度 88/100
DojoCodingLabs/hermit#39 ·
维护者通常 1 天内回复
查看 DojoCodingLabs/hermit 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 86/100
superlinked/sie#1033 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
remix-run/react-router#15838 ·
维护者通常 1 天内回复
-
area/ci bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
melgarafael/DeskcommCRM#5290 ·
维护者通常 1 天内回复