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

+2 -2
View File
@@ -6,7 +6,7 @@ const ini = require("ini");
const Jimp = require("jimp");
const JSZip = require("jszip");
const buildMod = require("@clusterio/lib/build_mod");
const libBuildMod = require("@clusterio/lib/build_mod");
/**
* Generate the export mod needed for exportData
@@ -29,7 +29,7 @@ async function generateExportMod(server) {
}
}
await buildMod.build({
await libBuildMod.build({
clean: false,
build: true,
pack: true,
+2 -2
View File
@@ -7,7 +7,7 @@ const jszip = require("jszip");
const path = require("path");
const semver = require("semver");
const hash = require("@clusterio/lib/hash");
const libHash = require("@clusterio/lib/hash");
const knownScenarios = {
@@ -225,7 +225,7 @@ async function patch(savePath, modules) {
// No info file present, try to detect if it's a known compatible scenario.
} else {
let controlStream = root.file("control.lua").nodeStream("nodebuffer");
let controlHash = await hash.hashStream(controlStream);
let controlHash = await libHash.hashStream(controlStream);
if (controlHash in knownScenarios) {
patchInfo = {
+2 -2
View File
@@ -9,7 +9,7 @@ const crypto = require("crypto");
const ini = require("ini");
const rconClient = require("rcon-client");
const errors = require("@clusterio/lib/errors");
const libErrors = require("@clusterio/lib/errors");
/**
@@ -705,7 +705,7 @@ class FactorioServer extends events.EventEmitter {
if (this._state !== "stopping") {
if (this._unexpected.length === 0) {
if (signal === "SIGKILL") {
this.emit("error", new errors.EnvironmentError(
this.emit("error", new libErrors.EnvironmentError(
"Factorio server was unexpectedly killed, is the system low on memory?"
));