chore: upgrade ts2lua-unreal to v0.3.1 with lowercase lib/module.lua & lib/class.lua and commit framework refactor
This commit is contained in:
1 parent
783dccf53d
commit
3572f2da43
206 files changed
+14442
-13186
No files matched your search
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env node
|
||||
import * as path from "node:path";
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
const tsRoot = path.resolve(import.meta.dirname, "..");
|
||||
const luaRoot = path.resolve(tsRoot, "..", "lua");
|
||||
|
||||
const luaBin = ["lua5.4", "lua"].find((cmd) => {
|
||||
const probe = spawnSync(cmd, ["-v"], { encoding: "utf8" });
|
||||
return probe.status === 0 && /Lua 5\.4/.test((probe.stdout || "") + (probe.stderr || ""));
|
||||
});
|
||||
|
||||
if (!luaBin) {
|
||||
console.error("[run-unit-tests] Lua 5.4 interpreter (lua5.4 / lua) not found in PATH.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const luaPath = [
|
||||
path.join(luaRoot, "?.lua"),
|
||||
path.join(luaRoot, "?", "init.lua"),
|
||||
process.env.LUA_PATH || "",
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(";");
|
||||
|
||||
const code = `
|
||||
package.path = ${JSON.stringify(luaPath)} .. ";" .. package.path
|
||||
require("lib.module")
|
||||
require("lib.class")
|
||||
local runner = __MODULE__.Import("tests.run_unit_tests")
|
||||
local summary = runner.RunAllUnitTests()
|
||||
if not summary or (summary.total or 0) <= 0 or (summary.failed or 0) > 0 then
|
||||
os.exit(1)
|
||||
end
|
||||
`;
|
||||
|
||||
const result = spawnSync(luaBin, ["-e", code], {
|
||||
stdio: "inherit",
|
||||
cwd: luaRoot,
|
||||
});
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
Reference in new issue
Block a user