Fully specify mod pack Factorio version

Remove support for major only versions of Factorio being specified in
mod packs.
This commit is contained in:
Hornwitser committed 2022-10-15 18:01:54 +02:00
1 parent 53a5d7ea6f
commit 660d0f08a1
3 files changed
+11 -11

No files matched your search

+4 -4
View File
@@ -991,8 +991,8 @@ modPackCommands.add(new libCommand.Command({
modPack.name = args.name; modPack.name = args.name;
if (args.description) { modPack.description = args.description; } if (args.description) { modPack.description = args.description; }
if (args.factorioVersion) { if (args.factorioVersion) {
if (!/^\d+\.\d+(\.\d+)?$/.test(args.factorioVersion)) { if (!/^\d+\.\d+\.\d+?$/.test(args.factorioVersion)) {
throw new libErrors.CommandError("factorio-version must match the format digit.digit[.digit]"); throw new libErrors.CommandError("factorio-version must match the format digit.digit.digit");
} }
modPack.factorioVersion = args.factorioVersion; modPack.factorioVersion = args.factorioVersion;
} }
@@ -1031,8 +1031,8 @@ modPackCommands.add(new libCommand.Command({
if (args.name) { modPack.name = args.name; } if (args.name) { modPack.name = args.name; }
if (args.description) { modPack.description = args.description; } if (args.description) { modPack.description = args.description; }
if (args.factorioVersion) { if (args.factorioVersion) {
if (!/^\d+\.\d+(\.\d+)?$/.test(args.factorioVersion)) { if (!/^\d+\.\d+\.\d+?$/.test(args.factorioVersion)) {
throw new libErrors.CommandError("factorio-version must match the format digit.digit[.digit]"); throw new libErrors.CommandError("factorio-version must match the format digit.digit.digit");
} }
modPack.factorioVersion = args.factorioVersion; modPack.factorioVersion = args.factorioVersion;
} }
@@ -620,8 +620,8 @@ export default function ModPackViewPage() {
name="factorioVersion" name="factorioVersion"
style={{ marginBottom: 0 }} style={{ marginBottom: 0 }}
rules={[{ rules={[{
pattern: /^\d+\.\d+(\.\d+)?$/, pattern: /^\d+\.\d+\.\d+?$/,
message: "Must be an a.b or a.b.c version number..", message: "Must be an a.b.c version number.",
}]} }]}
> >
<Input <Input
+5 -5
View File
@@ -823,13 +823,13 @@ describe("Integration of Clusterio", function() {
describe("mod-pack create", function() { describe("mod-pack create", function() {
it("should create a mod-pack", async function() { it("should create a mod-pack", async function() {
await execCtl("mod-pack create empty-pack 1.1"); await execCtl("mod-pack create empty-pack 1.1.0");
let response = await libLink.messages.listModPacks.send(getControl()); let response = await libLink.messages.listModPacks.send(getControl());
assert(response.list.some(modPack => modPack.name === "empty-pack"), "created pack is not in the list"); assert(response.list.some(modPack => modPack.name === "empty-pack"), "created pack is not in the list");
}); });
it("should allow setting all fields", async function() { it("should allow setting all fields", async function() {
await execCtl( await execCtl(
"mod-pack create full-pack 0.17 " + "mod-pack create full-pack 0.17.59 " +
"--description Description " + "--description Description " +
"--mods empty_mod:1.0.0 " + "--mods empty_mod:1.0.0 " +
"--bool-setting startup MyBool true " + "--bool-setting startup MyBool true " +
@@ -844,7 +844,7 @@ describe("Integration of Clusterio", function() {
reference.id = modPack.id; reference.id = modPack.id;
reference.name = "full-pack"; reference.name = "full-pack";
reference.description = "Description"; reference.description = "Description";
reference.factorioVersion = "0.17"; reference.factorioVersion = "0.17.59";
reference.mods.set("empty_mod", { name: "empty_mod", enabled: true, version: "1.0.0" }); reference.mods.set("empty_mod", { name: "empty_mod", enabled: true, version: "1.0.0" });
reference.settings["startup"].set("MyBool", { value: true }); reference.settings["startup"].set("MyBool", { value: true });
reference.settings["runtime-global"].set("MyInt", { value: 1235 }); reference.settings["runtime-global"].set("MyInt", { value: 1235 });
@@ -868,11 +868,11 @@ describe("Integration of Clusterio", function() {
describe("mod-pack edit", function() { describe("mod-pack edit", function() {
it("runs", async function() { it("runs", async function() {
await execCtl("mod-pack edit full-pack --factorio-version 1.2"); await execCtl("mod-pack edit full-pack --factorio-version 1.2.0");
let response = await libLink.messages.listModPacks.send(getControl()); let response = await libLink.messages.listModPacks.send(getControl());
let modPack = response.list.find(entry => entry.name === "full-pack"); let modPack = response.list.find(entry => entry.name === "full-pack");
assert(modPack, "created mod pack not found"); assert(modPack, "created mod pack not found");
assert.equal(modPack.factorio_version, "1.2"); assert.equal(modPack.factorio_version, "1.2.0");
}); });
}); });