@rsnl-gg/library-validator
v2026.9.4
Published
Validate Helldivers 2 .patch mods against game data: unit format compatibility and Lua script detection
Readme
Validates Helldivers 2 .patch mods against game data. It compares unit format versions, can rewrite outdated unit patches, and detects Lua scripts in a patch file or a mod folder.
Usage
npm install @rsnl-gg/library-validatorimport { checkUnitCompatibility, hasLuaScript } from "@rsnl-gg/library-validator";
const result = await checkUnitCompatibility(
"path/to/archive.patch_0",
"path/to/helldivers2/data",
);
if (!result.compatible) {
// result.reason is "no-unit" or "version-mismatch"
}
const repaired = await checkUnitCompatibility(
["path/to/archive.patch_0", "path/to/other.patch_0"],
"path/to/helldivers2/data",
{ repair: true },
);
// repaired is UnitCompatibility[] in input order
// entry.repaired is true when that version-mismatch patch was renamed to .backup_N
// and a new .patch_N was written. A failed write restores the original .patch_N name.
const hasLua = await hasLuaScript("path/to/mod");
if (hasLua.found) {
// no files written; extractedPaths is []
}
const extracted = await hasLuaScript("path/to/mod", true);
// extracted.extractedPaths is string[] of written .lua files
// LuaJIT bytecode dumps are decompiled to UTF-8 source before writingLibrary development
npm install
npm run build
npm run checknpm run buildcompilessrc/todist/npm run checkruns the integrity tests
Versioning is CalVer {year}.{month}.{iteration}. Iteration is 1 on the first publish of the month.
npm run releaseThe script asks for the version, then commits, tags, pushes, creates a GitHub Release, and only afterwards publishes to npm. GitHub Releases use GitHub CLI. Install it once with winget install --id GitHub.cli and authenticate with gh auth login.
License
MIT
