Skip to content

Commit 42e48a2

Browse files
committed
Updated for SPT 3.8
1 parent b6c7bb6 commit 42e48a2

File tree

522 files changed

+8884
-6263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

522 files changed

+8884
-6263
lines changed

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ end_of_line = lf
55
insert_final_newline = true
66
charset = utf-8
77
indent_style = space
8-
indent_size = 4
8+
indent_size = 4
9+
10+
[*.{yml,yaml}]
11+
indent_size = 2

.github/ISSUE_TEMPLATE/GENERAL.yml

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,41 @@ description: File a general bug report
33
title: "[Bug]: "
44
labels: ["triage"]
55
assignees:
6-
- refringe
6+
- refringe
77
body:
8-
- type: markdown
9-
attributes:
10-
value: Thank you for taking the time to fill out a bug report!
11-
- type: input
12-
id: discord-username
13-
attributes:
14-
label: Discord Username
15-
description: If we need more information, can we contact you on the SPT discord? What's your username?
16-
validations:
17-
required: false
18-
- type: textarea
19-
id: what-happened
20-
attributes:
21-
label: What happened?
22-
description: Also tell us, what did you expect to happen?
23-
placeholder: Tell us what you see!
24-
value: "A bug happened!"
25-
validations:
26-
required: true
27-
- type: dropdown
28-
id: version
29-
attributes:
30-
label: SPT Version
31-
description: What version of SPT are you running?
32-
options:
33-
- master
34-
- 3.7.1
35-
- 3.7.0
36-
- 3.6.0
37-
validations:
38-
required: true
39-
- type: textarea
40-
id: server-log
41-
attributes:
42-
label: Server Log
43-
description: Please paste the *entire* relevant server log (found in `user/logs/` directory) into this field.
44-
render: shell
45-
validations:
46-
required: true
8+
- type: markdown
9+
attributes:
10+
value: Thank you for taking the time to fill out a bug report!
11+
- type: input
12+
id: discord-username
13+
attributes:
14+
label: Discord Username
15+
description: If we need more information, can we contact you on the SPT discord? What's your username?
16+
validations:
17+
required: false
18+
- type: textarea
19+
id: what-happened
20+
attributes:
21+
label: What happened?
22+
description: Also tell us, what did you expect to happen?
23+
placeholder: Tell us what you see!
24+
value: "A bug happened!"
25+
validations:
26+
required: true
27+
- type: dropdown
28+
id: version
29+
attributes:
30+
label: SPT Version
31+
description: What version of SPT are you running?
32+
options:
33+
- 3.8.0
34+
validations:
35+
required: true
36+
- type: textarea
37+
id: server-log
38+
attributes:
39+
label: Server Log
40+
description: Please paste the *entire* relevant server log (found in `user/logs/` directory) into this field.
41+
render: shell
42+
validations:
43+
required: true

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.15.0
1+
v20.11.1

.prettierrc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,13 @@
44
"trailingComma": "es5",
55
"semi": true,
66
"printWidth": 120,
7-
"arrowParens": "avoid"
7+
"arrowParens": "avoid",
8+
"overrides": [
9+
{
10+
"files": ["*.yml", "*.yaml"],
11+
"options": {
12+
"tabWidth": 2
13+
}
14+
}
15+
]
816
}

build.mjs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
* - The script reads configurations from the `package.json` and `.buildignore` files; ensure they are correctly set up.
2727
*
2828
* @author Refringe
29-
* @version v1.0.0
29+
* @version v1.0.1
3030
*/
3131

3232
import archiver from "archiver";
3333
import fs from "fs-extra";
3434
import ignore from "ignore";
35-
import os from "os";
36-
import path, { dirname } from "path";
37-
import { fileURLToPath } from "url";
35+
import os from "node:os";
36+
import path, { dirname } from "node:path";
37+
import { fileURLToPath } from "node:url";
3838
import winston from "winston";
3939

4040
// Get the command line arguments to determine whether to use verbose logging.
@@ -96,9 +96,13 @@ async function main() {
9696
const packageJson = await loadPackageJson(currentDir);
9797

9898
// Create a descriptive name for the mod package.
99-
const projectName = createProjectName(packageJson);
99+
const projectName = createProjectName(packageJson, false);
100100
logger.log("success", `Project name created: ${projectName}`);
101101

102+
// Create a descriptive name for the ZIP file.
103+
const zipFileName = createProjectName(packageJson, true);
104+
logger.log("success", `Project package name created: ${zipFileName}`);
105+
102106
// Remove the old distribution directory and create a fresh one.
103107
const distDir = await removeOldDistDirectory(currentDir);
104108
logger.log("info", "Distribution directory successfully cleaned.");
@@ -115,13 +119,13 @@ async function main() {
115119

116120
// Create a zip archive of the project files.
117121
logger.log("info", "Beginning folder compression...");
118-
const zipFilePath = path.join(path.dirname(projectDir), `${projectName}.zip`);
119-
await createZipFile(projectDir, zipFilePath, "user/mods/" + projectName);
122+
const zipFilePath = path.join(path.dirname(projectDir), `${zipFileName}.zip`);
123+
await createZipFile(projectDir, zipFilePath, `user/mods/${projectName}`);
120124
logger.log("success", "Archive successfully created.");
121125
logger.log("info", zipFilePath);
122126

123127
// Move the zip file inside of the project directory, within the temporary working directory.
124-
const zipFileInProjectDir = path.join(projectDir, `${projectName}.zip`);
128+
const zipFileInProjectDir = path.join(projectDir, `${zipFileName}.zip`);
125129
await fs.move(zipFilePath, zipFileInProjectDir);
126130
logger.log("success", "Archive successfully moved.");
127131
logger.log("info", zipFileInProjectDir);
@@ -134,23 +138,23 @@ async function main() {
134138
logger.log("success", "------------------------------------");
135139
logger.log("success", "Build script completed successfully!");
136140
logger.log("success", "Your mod package has been created in the 'dist' directory:");
137-
logger.log("success", `/${path.relative(process.cwd(), path.join(distDir, `${projectName}.zip`))}`);
141+
logger.log("success", `${path.relative(process.cwd(), path.join(distDir, `${zipFileName}.zip`))}`);
138142
logger.log("success", "------------------------------------");
139143
if (!verbose) {
140144
logger.log("success", "To see a detailed build log, use `npm run buildinfo`.");
141145
logger.log("success", "------------------------------------");
142146
}
143147
} catch (err) {
144148
// If any of the file operations fail, log the error.
145-
logger.log("error", "An error occurred: " + err);
149+
logger.log("error", `An error occurred: ${err}`);
146150
} finally {
147151
// Clean up the temporary directory, even if the build fails.
148152
if (projectDir) {
149153
try {
150154
await fs.promises.rm(projectDir, { force: true, recursive: true });
151155
logger.log("info", "Cleaned temporary directory.");
152156
} catch (err) {
153-
logger.log("error", "Failed to clean temporary directory: " + err);
157+
logger.log("error", `Failed to clean temporary directory: ${err}`);
154158
}
155159
}
156160
}
@@ -220,18 +224,21 @@ async function loadPackageJson(currentDir) {
220224
* @param {Object} packageJson - A JSON object containing the contents of the `package.json` file.
221225
* @returns {string} A string representing the constructed project name.
222226
*/
223-
function createProjectName(packageJson) {
227+
function createProjectName(packageJson, includeVersion = true) {
224228
// Remove any non-alphanumeric characters from the author and name.
225229
const author = packageJson.author.replace(/\W/g, "");
226230
const name = packageJson.name.replace(/\W/g, "");
227231
const version = packageJson.version;
228232

229233
// Ensure the name is lowercase, as per the package.json specification.
230-
return `${author}-${name}-${version}`.toLowerCase();
234+
if (includeVersion) {
235+
return `${author}-${name}-${version}`.toLowerCase();
236+
}
237+
return `${author}-${name}`.toLowerCase();
231238
}
232239

233240
/**
234-
* Defines the location of the distribution directory where the final mod package will be stored and deletes any
241+
* Defines the location of the distribution directory where the final mod package will be stored and deletes any
235242
* existing distribution directory to ensure a clean slate for the build process.
236243
*
237244
* @param {string} currentDirectory - The absolute path of the current working directory.
@@ -322,7 +329,7 @@ async function copyFiles(srcDir, destDir, ignoreHandler) {
322329
await Promise.all(copyOperations);
323330
} catch (err) {
324331
// Log an error message if any error occurs during the copy process.
325-
logger.log("error", "Error copying files: " + err);
332+
logger.log("error", `Error copying files: ${err}`);
326333
}
327334
}
328335

@@ -346,14 +353,14 @@ async function createZipFile(directoryToZip, zipFilePath, containerDirName) {
346353
});
347354

348355
// Set up an event listener for the 'close' event to resolve the promise when the archiver has finalized.
349-
output.on("close", function () {
356+
output.on("close", () => {
350357
logger.log("info", "Archiver has finalized. The output and the file descriptor have closed.");
351358
resolve();
352359
});
353360

354361
// Set up an event listener for the 'warning' event to handle warnings appropriately, logging them or rejecting
355362
// the promise based on the error code.
356-
archive.on("warning", function (err) {
363+
archive.on("warning", err => {
357364
if (err.code === "ENOENT") {
358365
logger.log("warn", `Archiver issued a warning: ${err.code} - ${err.message}`);
359366
} else {
@@ -362,7 +369,7 @@ async function createZipFile(directoryToZip, zipFilePath, containerDirName) {
362369
});
363370

364371
// Set up an event listener for the 'error' event to reject the promise if any error occurs during archiving.
365-
archive.on("error", function (err) {
372+
archive.on("error", err => {
366373
reject(err);
367374
});
368375

0 commit comments

Comments
 (0)