modpack-lock 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modpack-lock",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Creates a modpack lockfile for files hosted on Modrinth (mods, resource packs, shaders and datapacks)",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/nickesc/modpack-lock/issues"
|
|
@@ -39,13 +39,16 @@
|
|
|
39
39
|
"src/**/*.js"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"commander": "^14.0.
|
|
42
|
+
"commander": "^14.0.3",
|
|
43
43
|
"prompts": "^2.4.2",
|
|
44
44
|
"slugify": "^1.6.6"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"
|
|
47
|
+
"@eslint/js": "^10.0.1",
|
|
48
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
49
|
+
"eslint": "^10.0.0",
|
|
50
|
+
"globals": "^17.3.0",
|
|
51
|
+
"typedoc": "^0.28.17",
|
|
49
52
|
"typedoc-github-theme": "^0.3.1",
|
|
50
53
|
"unzipper": "^0.12.3",
|
|
51
54
|
"vitest": "^4.0.16"
|
|
@@ -92,7 +92,7 @@ async function getJsonFile(directoryPath, filename) {
|
|
|
92
92
|
return JSON.parse(fileContent);
|
|
93
93
|
} catch (error) {
|
|
94
94
|
if (error.code !== "ENOENT") {
|
|
95
|
-
throw new Error(`Error: Could not read file ${jsonPath}: ${error.message}
|
|
95
|
+
throw new Error(`Error: Could not read file ${jsonPath}: ${error.message}`, {cause: error});
|
|
96
96
|
} else {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "fs/promises";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import * as config from "./config/index.js";
|
|
4
|
-
import {logm
|
|
4
|
+
import {logm} from "./logger.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @typedef {import('./config/types.js').Options} Options
|
|
@@ -28,7 +28,7 @@ export async function generateGitignoreRules(lockfile, workingDir, options = {})
|
|
|
28
28
|
rules.push(`*/**/*.disabled`);
|
|
29
29
|
|
|
30
30
|
// Find files not hosted on Modrinth
|
|
31
|
-
for (const [
|
|
31
|
+
for (const [, entries] of Object.entries(lockfile.dependencies)) {
|
|
32
32
|
for (const entry of entries) {
|
|
33
33
|
if (entry.version === null) {
|
|
34
34
|
exceptions.push(`!${entry.path}`);
|
|
@@ -61,7 +61,7 @@ export async function generateGitignoreRules(lockfile, workingDir, options = {})
|
|
|
61
61
|
const startMarkerIndex = existingContent.indexOf(config.GITIGNORE_START_MARKER);
|
|
62
62
|
const endMarkerIndex = existingContent.indexOf(config.GITIGNORE_END_MARKER);
|
|
63
63
|
|
|
64
|
-
let newContent
|
|
64
|
+
let newContent;
|
|
65
65
|
|
|
66
66
|
if (startMarkerIndex !== -1 && endMarkerIndex !== -1 && endMarkerIndex > startMarkerIndex) {
|
|
67
67
|
// Both markers exist, replace content between them
|
package/src/generate_license.js
CHANGED
|
@@ -47,7 +47,7 @@ export default async function generateLicense(modpackInfo, workingDir, options =
|
|
|
47
47
|
await writeLicense(licenseText, workingDir);
|
|
48
48
|
}
|
|
49
49
|
return licenseText;
|
|
50
|
-
} catch
|
|
50
|
+
} catch {
|
|
51
51
|
logm.warn(`Unable to generate license for: ${modpackInfo.license}`);
|
|
52
52
|
return null;
|
|
53
53
|
}
|
package/src/generate_readme.js
CHANGED
|
@@ -35,11 +35,11 @@ function generateCategoryReadme(category, entries, projectsMap, usersMap) {
|
|
|
35
35
|
|
|
36
36
|
for (const entry of entries) {
|
|
37
37
|
const version = entry.version;
|
|
38
|
-
let nameCell
|
|
39
|
-
let authorCell
|
|
40
|
-
let versionCell
|
|
41
|
-
let dependenciesCell
|
|
42
|
-
let dependantsCell
|
|
38
|
+
let nameCell;
|
|
39
|
+
let authorCell;
|
|
40
|
+
let versionCell;
|
|
41
|
+
let dependenciesCell;
|
|
42
|
+
let dependantsCell;
|
|
43
43
|
|
|
44
44
|
if (version && version.project_id) {
|
|
45
45
|
const project = projectsMap[version.project_id];
|
|
@@ -162,7 +162,7 @@ export async function generateReadmeFiles(lockfile, workingDir, options = {}) {
|
|
|
162
162
|
const projectIds = new Set();
|
|
163
163
|
const authorIds = new Set();
|
|
164
164
|
|
|
165
|
-
for (const [
|
|
165
|
+
for (const [, entries] of Object.entries(lockfile.dependencies)) {
|
|
166
166
|
for (const entry of entries) {
|
|
167
167
|
if (entry.version && entry.version.project_id) {
|
|
168
168
|
projectIds.add(entry.version.project_id);
|
|
@@ -35,7 +35,7 @@ export async function getLicenseList(featured = false) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return licenseSpdxIds;
|
|
38
|
-
} catch
|
|
38
|
+
} catch {
|
|
39
39
|
logm.warn(`Could not fetch license list. Using fallbacks.`);
|
|
40
40
|
const licenses = config.FALLBACK_LICENSES.push(config.ALL_RIGHTS_RESERVED_LICENSE);
|
|
41
41
|
licenses.push(config.OTHER_OPTION);
|
|
@@ -71,8 +71,7 @@ export async function getLicenseText(spdxId) {
|
|
|
71
71
|
} else {
|
|
72
72
|
throw new Error();
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
} catch (error) {
|
|
74
|
+
} catch {
|
|
76
75
|
logm.warn(`Could not find license text for: ${spdxId}`);
|
|
77
76
|
return null;
|
|
78
77
|
}
|
|
@@ -147,9 +147,8 @@ export async function getMinecraftVersions() {
|
|
|
147
147
|
} else {
|
|
148
148
|
throw new Error();
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
logm.warn(`Could not fetch Minecraft versions. Using fallbacks.`, error);
|
|
150
|
+
} catch {
|
|
151
|
+
logm.warn(`Could not fetch Minecraft versions. Using fallbacks.`);
|
|
153
152
|
return config.FALLBACK_TARGET_MINECRAFT_VERSIONS;
|
|
154
153
|
}
|
|
155
154
|
}
|
|
@@ -177,9 +176,8 @@ export async function getModloaders() {
|
|
|
177
176
|
} else {
|
|
178
177
|
throw new Error();
|
|
179
178
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
logm.warn(`Could not fetch Modloaders. Using fallbacks.`, error);
|
|
179
|
+
} catch {
|
|
180
|
+
logm.warn(`Could not fetch Modloaders. Using fallbacks.`);
|
|
183
181
|
return config.FALLBACK_MODLOADERS;
|
|
184
182
|
}
|
|
185
183
|
}
|