Move lua code to slave package and fix paths

Move the export and clusterio mod code to the slave package and fix the
path used for them.  Refactor tests to use temp/tests/ as the cwd when
running integration tests in order to ensure paths to lua code are
correctly handled.
This commit is contained in:
Hornwitser committed 2020-10-21 21:26:44 +02:00
1 parent 18e609f3fe
commit f06d3509e6
15 files changed
+37 -35

No files matched your search

+2 -3
View File
@@ -8,14 +8,13 @@ const yargs = require("yargs");
async function main() {
const libPath = path.join("lua", "clusterio_lib");
const args = yargs
.scriptName("build")
.options({
"clean": { describe: "Remove previous builds", type: "boolean", default: false },
"build": { describe: "Build mod", type: "boolean", default: true },
"pack": { describe: "Pack into zip file", type: "boolean", default: true },
"source-dir": { describe: "Path to mod source files", nargs: 1, type: "string", default: libPath },
"source-dir": { describe: "Path to mod source files", nargs: 1, type: "string", demandOption: true },
"output-dir": { describe: "Path to output built mod", nargs: 1, type: "string", default: "dist" },
"bump-patch": { describe: "Increment patch number of build", type: "boolean", default: false },
"factorio-version": { describe: "Override factorio_version", type: "string" },
@@ -79,7 +78,7 @@ async function build(args) {
await events.once(walker, "end");
for (let pathParts of info.additional_files || []) {
let filePath = path.join(...pathParts);
let filePath = path.join(args.sourceDir, ...pathParts);
zip.file(path.posix.join(modName, path.basename(filePath)), fs.createReadStream(filePath));
}
delete info.additional_files;
+2 -1
View File
@@ -33,7 +33,8 @@ async function generateExportMod(server) {
clean: false,
build: true,
pack: true,
sourceDir: path.join("lua", "export"),
// XXX fix path when moving lib/factorio to slave
sourceDir: path.join(__dirname, "..", "..", "slave", "lua", "export"),
outputDir: server.writePath("mods"),
bumpPatch: false,
factorioVersion: server.version.replace(/\.\d+$/, ""),