Repository navigation
feat(registry): 内容包必须声明适用规则,否则同步时给出 warning - #28
Merged
Merged
Conversation
线上 10 个 content-pack 的 requires 全是 null,客户端按规则筛选因此全是空的。 应用侧已改成「未声明 != 不匹配」,这里补索引侧,别再让新包漏声明。 - registry.cjs 新增 warnUndeclaredRuleset(),generateDetails 时检查 content-pack 是否声明 requires.rulesets 或 system_agnostic: true,缺失则 warning(暂不 error) - 模板 plugin.json 补 requires.rulesets 示例,README 增「声明适用规则」一节 - 新增 2 条测试:缺声明给 warning;显式声明/通用包/非内容包不误报 验证:node --test 15 passed;node scripts/validate.cjs 通过。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
客户端「在线内容包」按规则筛选时什么都筛不出来,但「全部规则」能看到全部 10 个包。
原因:应用侧靠 manifest 的
requires.rulesets[].id生成ruleset_targets,而线上 14 条索引里 10 个 content-pack 的requires全是null,ruleset_targets因此是空数组。应用侧已经改成「未声明 ≠ 不匹配」(diceframe#693)。这个 PR 补索引侧:让新提交的包别再漏声明。
改动
①
scripts/registry.cjs新增
warnUndeclaredRuleset(),在生成plugin_details.json时检查:plugin_type === "content-pack"system_agnostic: truerequires.rulesets缺失或为空→ 产出 warning:
先只发 warning,不 error:存量 10 个包需要作者逐个补,现在就 error 会让同步全线失败。
②
templates/content-pack/plugin.json模板里补上
requires.rulesets示例。③
templates/content-pack/README.md新增「声明适用规则(二选一,必须写)」一节:
"requires": { "rulesets": [{ "id": "core:dnd2024" }] }"system_agnostic": true,删掉requires验证
node --test tests/registry.test.cjs→ 15 passed(新增 2 条:缺声明给 warning、显式声明/通用包/非内容包不误报)node scripts/validate.cjs→Registry structure is valid.后续
requires.rulesets(coc-*→core:coc7,dnd-*→core:dnd2024,frieren-journey/hyouka/office-night需作者确认是否system_agnostic)diceframe-content的插件注册规范文档同步这一节