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

+4 -4
View File
@@ -411,14 +411,14 @@ class Instance extends link.Link{
}
// Find stand alone modules to load
// XXX for now it's assumed all available modules should be loaded.
for (let entry of await fs.readdir("modules", { withFileTypes: true })) {
// XXX for now only the included clusterio module is loaded
for (let entry of await fs.readdir(path.join(__dirname, "modules"), { withFileTypes: true })) {
if (entry.isDirectory()) {
if (modules.has(entry.name)) {
throw new Error(`Module with name ${entry.name} already exists in a plugin`);
}
let moduleJsonPath = path.join("modules", entry.name, "module.json");
let moduleJsonPath = path.join(__dirname, "modules", entry.name, "module.json");
if (!await fs.pathExists(moduleJsonPath)) {
throw new Error(`Module ${entry.name} is missing module.json`);
}
@@ -429,7 +429,7 @@ class Instance extends link.Link{
}
module = {
path: path.join("modules", entry.name),
path: path.join(__dirname, "modules", entry.name),
dependencies: { "clusterio": "*" },
load: [],
require: [],