Add MajorMinorVersion type and dedupe the game version regex

Address review feedback: introduce a MajorMinorVersion type with
isMajorMinorVersion, rename majorMinorVersion to normaliseMajorMinorVersion,
and type ModInfo.factorioVersion as MajorMinorVersion so already-reduced
values are not re-reduced (ModPackViewPage uses mod.info.factorioVersion
directly). Reuse the single gameVersionRegExp in both GameVersionSchema and
normaliseGameVersion instead of duplicating the pattern.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 4.8 committed 2026-06-29 22:12:36 +00:00
1 parent 97a6c32838
commit 7c2793752d
6 files changed
+47 -21

No files matched your search

+1 -1
View File
@@ -114,7 +114,7 @@ modCommands.add(new lib.Command({
}
let response = await control.send(new lib.ModSearchRequest(
args.query,
lib.majorMinorVersion(searchVersion),
lib.normaliseMajorMinorVersion(searchVersion),
args.page,
args.pageSize,
args.sort,