Prefix clusterio/lib imports with lib

Use lib* prefix for the modules impored from the lib package to help
distinguish them more from ordinary variables.  Fix up the naming
convention for files to be consistently lowercase_underscore for
JavaScript files.
This commit is contained in:
Hornwitser committed 2020-10-23 21:22:43 +02:00
1 parent fbbaf3dd3a
commit 24397b75cc
55 files changed
+692 -668

No files matched your search

+8 -6
View File
@@ -4,8 +4,8 @@ const events = require("events");
const fs = require("fs-extra");
const path = require("path");
const factorio = require("@clusterio/lib/factorio");
const errors = require("@clusterio/lib/errors");
const libFactorio = require("@clusterio/lib/factorio");
const libErrors = require("@clusterio/lib/errors");
const { slowTest } = require("./index");
@@ -13,7 +13,7 @@ const { slowTest } = require("./index");
describe("Integration of lib/factorio/server", function() {
describe("_getVersion()", function() {
it("should get a version from factorio's changelog.txt", async function() {
let version = await factorio._getVersion(path.join("factorio", "data", "changelog.txt"));
let version = await libFactorio._getVersion(path.join("factorio", "data", "changelog.txt"));
if (!/^\d+\.\d+\.\d+$/.test(version)) {
assert.fail(`Detected version '${version}' does not followed the format x.y.z`);
}
@@ -22,7 +22,7 @@ describe("Integration of lib/factorio/server", function() {
describe("class FactorioServer", function() {
let writePath = path.join("temp", "test", "integration");
let server = new factorio.FactorioServer("factorio", writePath, {});
let server = new libFactorio.FactorioServer("factorio", writePath, {});
let logFile;
before(async function() {
@@ -215,7 +215,9 @@ describe("Integration of lib/factorio/server", function() {
await assert.rejects(
startPromise,
new errors.EnvironmentError("Factorio server was unexpectedly killed, is the system low on memory?")
new libErrors.EnvironmentError(
"Factorio server was unexpectedly killed, is the system low on memory?"
)
);
});
@@ -225,7 +227,7 @@ describe("Integration of lib/factorio/server", function() {
await assert.rejects(
server.start("does-not-exist.zip"),
new errors.EnvironmentError("Factorio server unexpectedly shut down with code 1")
new libErrors.EnvironmentError("Factorio server unexpectedly shut down with code 1")
);
});
});