modpack-lock 0.5.0 → 0.6.0
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/README.md +2 -2
- package/package.json +2 -2
- package/src/cli.js +121 -120
- package/src/config/api.js +11 -2
- package/src/config/constants.js +13 -10
- package/src/config/defaults.js +42 -42
- package/src/config/index.js +6 -6
- package/src/config/options.js +7 -5
- package/src/config/strings.js +38 -41
- package/src/config/types.js +3 -2
- package/src/directory_scanning.js +15 -14
- package/src/generate_gitignore.js +113 -0
- package/src/generate_json.js +40 -39
- package/src/generate_license.js +25 -21
- package/src/generate_lockfile.js +68 -298
- package/src/generate_readme.js +224 -0
- package/src/github_interactions.js +21 -15
- package/src/logger.js +178 -0
- package/src/modpack-lock.js +47 -11
- package/src/modpack_info.js +102 -117
- package/src/modrinth_interactions.js +37 -16
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<a href="https://www.npmjs.com/package/modpack-lock"><img alt="NPM: npmjs.com/package/modpack-lock" src="https://img.shields.io/npm/v/modpack-lock?style=for-the-badge&logo=npm&logoColor=white&label=npm&color=%23C12127&labelColor=%23505050"></a>
|
|
2
|
-
<a href="https://github.com/nickesc/modpack-lock"><img alt="Source:
|
|
3
|
-
<a href="https://github.com/nickesc/modpack-lock/actions/workflows/
|
|
2
|
+
<a href="https://github.com/nickesc/modpack-lock"><img alt="Source: github.com/nickesc/modpack-lock" src="https://img.shields.io/badge/source-github-brightgreen?style=for-the-badge&logo=github&labelColor=%23505050"></a>
|
|
3
|
+
<a href="https://github.com/nickesc/modpack-lock/actions/workflows/modpack-lock-tests.yml"><img alt="Tests: github.com/nickesc/modpack-lock/actions/workflows/modpack-lock-tests.yml" src="https://img.shields.io/github/actions/workflow/status/nickesc/modpack-lock/modpack-lock-tests.yml?logo=github&label=tests&logoColor=white&style=for-the-badge&labelColor=%23505050"></a>
|
|
4
4
|
|
|
5
5
|
# modpack-lock
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modpack-lock",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://nickesc.github.io/modpack-lock",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"author": "N. Escobar <nick@
|
|
14
|
+
"author": "N. Escobar <nick@nickesc.io> (https://nickesc.github.io/)",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "src/modpack-lock.js",
|
|
17
17
|
"bin": {
|
package/src/cli.js
CHANGED
|
@@ -1,48 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env NODE_OPTIONS=--no-warnings node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import slugify from
|
|
5
|
-
import path from
|
|
6
|
-
import {
|
|
7
|
-
import {generateLockfile} from
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const modpackLock = new Command('modpack-lock');
|
|
17
|
-
|
|
18
|
-
const originalLogs = {
|
|
19
|
-
log: console.log,
|
|
20
|
-
info: console.info,
|
|
21
|
-
warn: console.warn,
|
|
22
|
-
error: console.error,
|
|
23
|
-
};
|
|
3
|
+
import {Command} from "commander";
|
|
4
|
+
import slugify from "slugify";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import {spawn} from "child_process";
|
|
7
|
+
import {generateLockfile, printLockfileSummary} from "./generate_lockfile.js";
|
|
8
|
+
import {generateReadmeFiles} from "./generate_readme.js";
|
|
9
|
+
import {generateGitignoreRules} from "./generate_gitignore.js";
|
|
10
|
+
import {generateModpackFiles} from "./modpack-lock.js";
|
|
11
|
+
import {promptUserForInfo, promptUserAboutOptionalFiles} from "./modpack_info.js";
|
|
12
|
+
import {getModpackInfo} from "./directory_scanning.js";
|
|
13
|
+
import * as config from "./config/index.js";
|
|
14
|
+
import pkg from "../package.json" with {type: "json"};
|
|
15
|
+
import {logm, styleText} from "./logger.js";
|
|
24
16
|
|
|
25
|
-
|
|
26
|
-
* Silence all console.log output
|
|
27
|
-
*/
|
|
28
|
-
function quietConsole(silent = false) {
|
|
29
|
-
console.log = () => { };
|
|
30
|
-
console.info = () => { };
|
|
31
|
-
if (silent) {
|
|
32
|
-
console.warn = () => { };
|
|
33
|
-
console.error = () => { };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Restore the console's original functions
|
|
39
|
-
*/
|
|
40
|
-
function restoreConsole() {
|
|
41
|
-
console.log = originalLogs.log;
|
|
42
|
-
console.info = originalLogs.info;
|
|
43
|
-
console.warn = originalLogs.warn;
|
|
44
|
-
console.error = originalLogs.error;
|
|
45
|
-
}
|
|
17
|
+
const modpackLock = new Command("modpack-lock");
|
|
46
18
|
|
|
47
19
|
/**
|
|
48
20
|
* Merge modpack info with priority: options > existingInfo > defaults
|
|
@@ -71,61 +43,80 @@ modpackLock
|
|
|
71
43
|
.description(pkg.description)
|
|
72
44
|
.summary("Create a modpack lockfile")
|
|
73
45
|
.optionsGroup(config.headings.options)
|
|
74
|
-
.option(
|
|
75
|
-
.option(
|
|
46
|
+
.option("-p, --path <path>", "Path to the modpack directory")
|
|
47
|
+
.option("-d, --dry-run", "Dry-run mode - no files will be written")
|
|
76
48
|
.optionsGroup(config.headings.generation)
|
|
77
|
-
.option(
|
|
78
|
-
.option(
|
|
49
|
+
.option("-l, --licenseFile", config.fileFields.addLicense.option)
|
|
50
|
+
.option("-g, --gitignore", config.fileFields.addGitignore.option)
|
|
51
|
+
.option("-r, --readme", config.fileFields.addReadme.option)
|
|
79
52
|
.optionsGroup(config.headings.logging)
|
|
80
|
-
.option(
|
|
81
|
-
.option(
|
|
53
|
+
.option("-q, --quiet", "Quiet mode - only show errors and warnings")
|
|
54
|
+
.option("-s, --silent", "Silent mode - no output")
|
|
82
55
|
.optionsGroup(config.headings.information)
|
|
83
56
|
.helpOption("-h, --help", `display help for ${pkg.name}`)
|
|
84
|
-
.version(pkg.version,
|
|
57
|
+
.version(pkg.version, "-V")
|
|
85
58
|
.action(async (options) => {
|
|
86
59
|
try {
|
|
87
60
|
const currDir = options.path || process.cwd();
|
|
88
61
|
|
|
89
|
-
|
|
90
|
-
quietConsole();
|
|
91
|
-
} else if (options.silent) {
|
|
92
|
-
quietConsole(true);
|
|
93
|
-
}
|
|
62
|
+
logm.quietFromOptions(options);
|
|
94
63
|
|
|
95
64
|
const modpackInfo = await getModpackInfo(currDir);
|
|
96
65
|
if (modpackInfo) {
|
|
97
|
-
await generateModpackFiles(modpackInfo, currDir, options);
|
|
66
|
+
const lockfile = await generateModpackFiles(modpackInfo, currDir, options);
|
|
67
|
+
printLockfileSummary(lockfile);
|
|
98
68
|
} else {
|
|
99
|
-
|
|
69
|
+
// Warn if license option is passed but no modpack.json exists
|
|
70
|
+
if (options.licenseFile) {
|
|
71
|
+
logm.warn(`License generation requires a ${config.MODPACK_JSON_NAME} file. Skipping license generation.`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Generate lockfile
|
|
75
|
+
const lockfile = await generateLockfile(currDir, options);
|
|
76
|
+
|
|
77
|
+
if (options.gitignore || options.readme) {
|
|
78
|
+
logm.header("Generating Optional Files");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Generate gitignore if requested
|
|
82
|
+
if (options.gitignore) {
|
|
83
|
+
await generateGitignoreRules(lockfile, currDir, options);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Generate README files if requested
|
|
87
|
+
if (options.readme) {
|
|
88
|
+
await generateReadmeFiles(lockfile, currDir, options);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
printLockfileSummary(lockfile);
|
|
100
92
|
}
|
|
101
93
|
} catch (error) {
|
|
102
|
-
|
|
94
|
+
logm.error(error);
|
|
103
95
|
process.exitCode = 1;
|
|
104
96
|
}
|
|
105
97
|
});
|
|
106
98
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.description(jsonDescription)
|
|
99
|
+
modpackLock
|
|
100
|
+
.command("init")
|
|
101
|
+
.description(`Initialize a modpack with a ${config.MODPACK_JSON_NAME} file and a ${config.MODPACK_LOCKFILE_NAME} lockfile.`)
|
|
111
102
|
.optionsGroup(config.headings.options)
|
|
112
|
-
.option(
|
|
113
|
-
.option("-n, --noninteractive",
|
|
114
|
-
.option(
|
|
115
|
-
.option(
|
|
116
|
-
.option(
|
|
103
|
+
.option("-f, --folder <path>", "Path to the modpack directory")
|
|
104
|
+
.option("-n, --noninteractive", "Non-interactive mode - must provide options for required fields")
|
|
105
|
+
.option("--add-license", config.fileFields.addLicense.option)
|
|
106
|
+
.option("--add-gitignore", config.fileFields.addGitignore.option)
|
|
107
|
+
.option("--add-readme", config.fileFields.addReadme.option)
|
|
117
108
|
.optionsGroup(config.headings.packInfo)
|
|
118
|
-
.option(
|
|
119
|
-
.option(
|
|
120
|
-
.option(
|
|
121
|
-
.option(
|
|
122
|
-
.option(
|
|
123
|
-
.option(
|
|
124
|
-
.option(
|
|
125
|
-
.option(
|
|
126
|
-
.option(
|
|
127
|
-
.option(
|
|
128
|
-
.option(
|
|
109
|
+
.option("--name <name>", config.infoFields.name.option)
|
|
110
|
+
.option("--version <version>", config.infoFields.version.option)
|
|
111
|
+
.option("--id <id>", config.infoFields.id.option)
|
|
112
|
+
.option("--description <description>", config.infoFields.description.option)
|
|
113
|
+
.option("--author <author>", config.infoFields.author.option)
|
|
114
|
+
.option("--projectUrl <projectUrl>", config.infoFields.projectUrl.option)
|
|
115
|
+
.option("--sourceUrl <sourceUrl>", config.infoFields.sourceUrl.option)
|
|
116
|
+
.option("--license <license>", config.infoFields.license.option)
|
|
117
|
+
.option("--modloader <modloader>", config.infoFields.modloader.option)
|
|
118
|
+
.option("--targetModloaderVersion <targetModloaderVersion>", config.infoFields.targetModloaderVersion.option)
|
|
119
|
+
.option("--targetMinecraftVersion <targetMinecraftVersion>", config.infoFields.targetMinecraftVersion.option)
|
|
129
120
|
.optionsGroup(config.headings.information)
|
|
130
121
|
.helpOption("-h, --help", `display help for ${pkg.name} init`)
|
|
131
122
|
.action(async (options) => {
|
|
@@ -135,9 +126,13 @@ modpackLock.command('init')
|
|
|
135
126
|
let existingInfo = await getModpackInfo(currDir);
|
|
136
127
|
|
|
137
128
|
if (options.noninteractive) {
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
129
|
+
logm.quiet();
|
|
130
|
+
if (
|
|
131
|
+
(!options.author && !existingInfo?.author) ||
|
|
132
|
+
(!options.modloader && !existingInfo?.modloader) ||
|
|
133
|
+
(!options.targetMinecraftVersion && !existingInfo?.targetMinecraftVersion)
|
|
134
|
+
) {
|
|
135
|
+
logm.error("Must provide options for required fields");
|
|
141
136
|
process.exitCode = 1;
|
|
142
137
|
return;
|
|
143
138
|
} else {
|
|
@@ -146,38 +141,45 @@ modpackLock.command('init')
|
|
|
146
141
|
name: defaultName,
|
|
147
142
|
version: config.DEFAULT_MODPACK_VERSION,
|
|
148
143
|
id: defaultName,
|
|
149
|
-
description:
|
|
144
|
+
description: "",
|
|
150
145
|
author: options.author, // Required, no default
|
|
151
|
-
projectUrl:
|
|
152
|
-
sourceUrl:
|
|
153
|
-
license:
|
|
146
|
+
projectUrl: "",
|
|
147
|
+
sourceUrl: "",
|
|
148
|
+
license: "",
|
|
154
149
|
modloader: options.modloader, // Required, no default
|
|
155
|
-
targetModloaderVersion:
|
|
150
|
+
targetModloaderVersion: "",
|
|
156
151
|
targetMinecraftVersion: options.targetMinecraftVersion, // Required, no default
|
|
157
152
|
};
|
|
158
153
|
|
|
159
154
|
const modpackInfo = mergeModpackInfo(existingInfo, options, defaults);
|
|
160
155
|
modpackInfo.id = slugify(modpackInfo.id, config.SLUGIFY_OPTIONS);
|
|
161
156
|
|
|
162
|
-
if (options.addLicense) {
|
|
163
|
-
await generateLicense(modpackInfo, currDir, options);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
157
|
options.readme = options.addReadme;
|
|
167
158
|
options.gitignore = options.addGitignore;
|
|
159
|
+
options.licenseFile = options.addLicense;
|
|
168
160
|
|
|
169
161
|
// generate the modpack files
|
|
170
162
|
try {
|
|
171
163
|
await generateModpackFiles(modpackInfo, currDir, options);
|
|
172
164
|
} catch (error) {
|
|
173
|
-
|
|
165
|
+
logm.error(error);
|
|
174
166
|
process.exitCode = 1;
|
|
175
167
|
}
|
|
176
168
|
}
|
|
177
169
|
} else {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
170
|
+
logm.info(logm.label("modpack-lock"), styleText(["bold", "italic", "blueBright"], "init"));
|
|
171
|
+
logm.newline();
|
|
172
|
+
logm.info(styleText(["dim"], "This utility will walk you through creating a"),
|
|
173
|
+
config.MODPACK_JSON_NAME,
|
|
174
|
+
styleText(["dim"], "file and a"),
|
|
175
|
+
config.MODPACK_LOCKFILE_NAME,
|
|
176
|
+
styleText(["dim"], "lockfile. It only covers the most common items, and tries to guess sensible defaults."),
|
|
177
|
+
);
|
|
178
|
+
logm.newline();
|
|
179
|
+
logm.info(styleText(["dim"], "See"), styleText(["white", "bgGray", "italic"], "modpack-lock init --help"), styleText(["dim"], "for definitive documentation on these fields and exactly what they do."));
|
|
180
|
+
logm.newline();
|
|
181
|
+
logm.info(styleText(["dim"], "Press"), styleText(["yellow"], "^C"), styleText(["dim"], "at any time to quit."));
|
|
182
|
+
logm.newline();
|
|
181
183
|
try {
|
|
182
184
|
const defaults = {
|
|
183
185
|
name: path.basename(currDir),
|
|
@@ -194,35 +196,34 @@ modpackLock.command('init')
|
|
|
194
196
|
};
|
|
195
197
|
|
|
196
198
|
// prompt user for modpack information
|
|
197
|
-
const modpackInfo = await promptUserForInfo(
|
|
198
|
-
mergeModpackInfo(existingInfo, options, defaults)
|
|
199
|
-
);
|
|
199
|
+
const modpackInfo = await promptUserForInfo(mergeModpackInfo(existingInfo, options, defaults));
|
|
200
200
|
|
|
201
201
|
// prompt user if they want to add the license text
|
|
202
202
|
const optionalFiles = await promptUserAboutOptionalFiles(modpackInfo, options);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
await generateLicense(modpackInfo, currDir, options);
|
|
206
|
-
}
|
|
207
|
-
console.log();
|
|
203
|
+
|
|
204
|
+
logm.newline();
|
|
208
205
|
|
|
209
206
|
// generate the modpack files
|
|
210
207
|
options.readme = optionalFiles.addReadme;
|
|
211
208
|
options.gitignore = optionalFiles.addGitignore;
|
|
212
|
-
|
|
209
|
+
options.licenseFile = optionalFiles.addLicense;
|
|
210
|
+
const lockfile = await generateModpackFiles(modpackInfo, currDir, options);
|
|
211
|
+
|
|
212
|
+
printLockfileSummary(lockfile);
|
|
213
213
|
} catch (error) {
|
|
214
|
-
|
|
214
|
+
logm.error(error);
|
|
215
215
|
process.exitCode = 1;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
-
modpackLock
|
|
220
|
+
modpackLock
|
|
221
|
+
.command("run")
|
|
221
222
|
.description(`Run a script defined in the ${config.MODPACK_JSON_NAME} file's 'scripts' field`)
|
|
222
|
-
.argument(
|
|
223
|
+
.argument("<script>", "The name of the script to run")
|
|
223
224
|
.optionsGroup(config.headings.options)
|
|
224
|
-
.option(
|
|
225
|
-
.option(
|
|
225
|
+
.option("-f, --folder <path>", "Path to the modpack directory")
|
|
226
|
+
.option("-D, --debug", "Debug mode -- show more information about how the command is being parsed")
|
|
226
227
|
.optionsGroup(config.headings.information)
|
|
227
228
|
.helpOption("-h, --help", `display help for ${pkg.name} run`)
|
|
228
229
|
.allowExcessArguments(true)
|
|
@@ -231,7 +232,7 @@ modpackLock.command('run')
|
|
|
231
232
|
options._run = true;
|
|
232
233
|
try {
|
|
233
234
|
if (options.debug) {
|
|
234
|
-
|
|
235
|
+
logm.debug("COMMAND:", command);
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
const currDir = options.folder || process.cwd();
|
|
@@ -251,39 +252,39 @@ modpackLock.command('run')
|
|
|
251
252
|
// build the full command
|
|
252
253
|
const scriptCommand = modpackInfo.scripts[script];
|
|
253
254
|
const args = command.args ? command.args.slice(1) : [];
|
|
254
|
-
const fullCommand = `${scriptCommand} ${args.join(
|
|
255
|
+
const fullCommand = `${scriptCommand} ${args.join(" ")}`;
|
|
255
256
|
|
|
256
257
|
// debug logging
|
|
257
258
|
if (options.debug) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
259
|
+
logm.debug("CURR DIR:", currDir);
|
|
260
|
+
logm.debug("OPTIONS:", options);
|
|
261
|
+
logm.debug("SCRIPT:", script);
|
|
262
|
+
logm.debug("SCRIPT COMMAND:", scriptCommand);
|
|
263
|
+
logm.debug("ARGS:", args);
|
|
264
|
+
logm.debug("FULL COMMAND:", fullCommand);
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
// spawn the command
|
|
267
268
|
const child = spawn(fullCommand, [], {
|
|
268
269
|
shell: true,
|
|
269
|
-
stdio:
|
|
270
|
-
cwd: currDir
|
|
270
|
+
stdio: "inherit",
|
|
271
|
+
cwd: currDir,
|
|
271
272
|
});
|
|
272
273
|
|
|
273
274
|
// preserve exit code on completion
|
|
274
275
|
const exitCode = await new Promise((resolve) => {
|
|
275
|
-
child.on(
|
|
276
|
+
child.on("close", (code) => {
|
|
276
277
|
resolve(code || 0);
|
|
277
278
|
});
|
|
278
279
|
});
|
|
279
280
|
process.exitCode = exitCode;
|
|
280
281
|
} catch (error) {
|
|
281
|
-
|
|
282
|
+
logm.error(error.message);
|
|
282
283
|
process.exitCode = 1;
|
|
283
284
|
}
|
|
284
285
|
});
|
|
285
286
|
|
|
286
287
|
modpackLock.parseAsync().catch((error) => {
|
|
287
|
-
|
|
288
|
+
logm.error(error);
|
|
288
289
|
process.exit(1);
|
|
289
290
|
});
|
package/src/config/api.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import pkg from "../../package.json" with {type: "json"};
|
|
2
|
+
import * as constants from "./constants.js";
|
|
3
|
+
|
|
4
|
+
/** User-Agent header for Modrinth API requests */
|
|
5
|
+
export const PACKAGE_USER_AGENT = `${constants.AUTHOR_USERNAME}/${pkg.name}/${pkg.version}`;
|
|
6
|
+
|
|
1
7
|
/** Modrinth API base URL */
|
|
2
|
-
export const MODRINTH_API_BASE =
|
|
8
|
+
export const MODRINTH_API_BASE = "https://api.modrinth.com/v2";
|
|
3
9
|
|
|
4
10
|
/** Modrinth version files endpoint */
|
|
5
11
|
export const MODRINTH_VERSION_FILES_ENDPOINT = `${MODRINTH_API_BASE}/version_files`;
|
|
@@ -20,7 +26,7 @@ export const MODRINTH_MODLOADERS_ENDPOINT = `${MODRINTH_API_BASE}/tag/loader`;
|
|
|
20
26
|
export const BATCH_SIZE = 100;
|
|
21
27
|
|
|
22
28
|
/** GitHub API base URL */
|
|
23
|
-
export const GITHUB_API_BASE =
|
|
29
|
+
export const GITHUB_API_BASE = "https://api.github.com";
|
|
24
30
|
|
|
25
31
|
/** GitHub licenses endpoint */
|
|
26
32
|
export const GITHUB_LICENSES_ENDPOINT = `${GITHUB_API_BASE}/licenses`;
|
|
@@ -30,3 +36,6 @@ export const GITHUB_FEATURED_LICENSES_ENDPOINT = `${GITHUB_LICENSES_ENDPOINT}?fe
|
|
|
30
36
|
|
|
31
37
|
/** GitHub license endpoint */
|
|
32
38
|
export const GITHUB_LICENSE_ENDPOINT = (license) => `${GITHUB_API_BASE}/licenses/${license}`;
|
|
39
|
+
|
|
40
|
+
/** GitHub Accept request header */
|
|
41
|
+
export const GITHUB_ACCEPT_HEADER = "application/vnd.github+json";
|
package/src/config/constants.js
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
import pkg from
|
|
1
|
+
import pkg from "../../package.json" with {type: "json"};
|
|
2
|
+
|
|
3
|
+
/** Author username */
|
|
4
|
+
export const AUTHOR_USERNAME = "nickesc";
|
|
2
5
|
|
|
3
6
|
/** Lockfile format version -- increment on changes to the format */
|
|
4
7
|
export const LOCKFILE_VERSION = "1.0.1";
|
|
5
8
|
|
|
6
9
|
/** Required fields for the modpack information */
|
|
7
10
|
export const MODPACK_INFO_REQUIRED_FIELDS = [
|
|
8
|
-
"name",
|
|
11
|
+
"name", //
|
|
9
12
|
"version",
|
|
10
13
|
"id",
|
|
11
14
|
"author",
|
|
12
15
|
"modloader",
|
|
13
|
-
"targetMinecraftVersion"
|
|
16
|
+
"targetMinecraftVersion",
|
|
14
17
|
];
|
|
15
18
|
|
|
16
19
|
/** Dependency categories, corresponds to folders in Minecraft profile */
|
|
17
20
|
export const DEPENDENCY_CATEGORIES = [
|
|
18
|
-
"mods",
|
|
21
|
+
"mods", //
|
|
19
22
|
"resourcepacks",
|
|
20
23
|
"shaderpacks",
|
|
21
|
-
"datapacks"
|
|
24
|
+
"datapacks",
|
|
22
25
|
];
|
|
23
26
|
|
|
24
27
|
/** Minecraft version types */
|
|
25
28
|
export const MINECRAFT_VERSION_TYPES = [
|
|
26
|
-
"release",
|
|
29
|
+
"release", //
|
|
27
30
|
"alpha",
|
|
28
31
|
"beta",
|
|
29
|
-
"snapshot"
|
|
32
|
+
"snapshot",
|
|
30
33
|
];
|
|
31
34
|
|
|
32
|
-
const gitignoreMarker = (mode) =>
|
|
35
|
+
const gitignoreMarker = (mode) => `# ${pkg.name}:${mode}`;
|
|
33
36
|
|
|
34
37
|
/** Gitignore section start marker */
|
|
35
|
-
export const GITIGNORE_START_MARKER = gitignoreMarker(
|
|
38
|
+
export const GITIGNORE_START_MARKER = gitignoreMarker("start");
|
|
36
39
|
|
|
37
40
|
/** Gitignore section end marker */
|
|
38
|
-
export const GITIGNORE_END_MARKER = gitignoreMarker(
|
|
41
|
+
export const GITIGNORE_END_MARKER = gitignoreMarker("end");
|
package/src/config/defaults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const DEFAULT_MODPACK_VERSION =
|
|
1
|
+
export const DEFAULT_MODPACK_VERSION = "1.0.0";
|
|
2
2
|
|
|
3
|
-
export const DEFAULT_MODPACK_LICENSE =
|
|
3
|
+
export const DEFAULT_MODPACK_LICENSE = "mit";
|
|
4
4
|
|
|
5
5
|
export const DEFAULT_PROJECT_URL = (id) => {
|
|
6
6
|
return `https://modrinth.com/modpack/${id}`;
|
|
@@ -10,57 +10,57 @@ export const DEFAULT_SOURCE_URL = (id, author) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
/** All-Rights-Reserved license option */
|
|
13
|
-
export const ALL_RIGHTS_RESERVED_LICENSE = {
|
|
13
|
+
export const ALL_RIGHTS_RESERVED_LICENSE = {title: "All-Rights-Reserved", value: "all-rights-reserved"};
|
|
14
14
|
|
|
15
15
|
/** Other option */
|
|
16
|
-
export const OTHER_OPTION = {
|
|
16
|
+
export const OTHER_OPTION = {title: "Other", value: "other"};
|
|
17
17
|
|
|
18
18
|
/** Fallback licenses */
|
|
19
19
|
export const FALLBACK_LICENSES = [
|
|
20
|
-
{
|
|
21
|
-
{
|
|
22
|
-
{
|
|
23
|
-
{
|
|
20
|
+
{title: "MIT", value: "mit"},
|
|
21
|
+
{title: "Apache-2.0", value: "apache-2.0"},
|
|
22
|
+
{title: "GPL-3.0", value: "gpl-3.0"},
|
|
23
|
+
{title: "CC0-1.0", value: "cc0-1.0"},
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
/** Fallback modloaders */
|
|
27
27
|
export const FALLBACK_MODLOADERS = [
|
|
28
|
-
{
|
|
29
|
-
{
|
|
30
|
-
{
|
|
31
|
-
{
|
|
32
|
-
{
|
|
33
|
-
{
|
|
34
|
-
{
|
|
35
|
-
{
|
|
36
|
-
{
|
|
28
|
+
{title: "fabric", value: "fabric"},
|
|
29
|
+
{title: "forge", value: "forge"},
|
|
30
|
+
{title: "neoforge", value: "neoforge"},
|
|
31
|
+
{title: "paper", value: "paper"},
|
|
32
|
+
{title: "purpur", value: "purpur"},
|
|
33
|
+
{title: "quilt", value: "quilt"},
|
|
34
|
+
{title: "sponge", value: "sponge"},
|
|
35
|
+
{title: "spigot", value: "spigot"},
|
|
36
|
+
{title: "vanilla", value: "vanilla"},
|
|
37
37
|
];
|
|
38
38
|
|
|
39
39
|
/** Fallback target Minecraft versions */
|
|
40
40
|
export const FALLBACK_TARGET_MINECRAFT_VERSIONS = [
|
|
41
|
-
{
|
|
42
|
-
{
|
|
43
|
-
{
|
|
44
|
-
{
|
|
45
|
-
{
|
|
46
|
-
{
|
|
47
|
-
{
|
|
48
|
-
{
|
|
49
|
-
{
|
|
50
|
-
{
|
|
51
|
-
{
|
|
52
|
-
{
|
|
53
|
-
{
|
|
54
|
-
{
|
|
55
|
-
{
|
|
56
|
-
{
|
|
57
|
-
{
|
|
58
|
-
{
|
|
59
|
-
{
|
|
60
|
-
{
|
|
61
|
-
{
|
|
62
|
-
{
|
|
63
|
-
{
|
|
64
|
-
{
|
|
65
|
-
{
|
|
41
|
+
{title: "1.21.x", value: "1.21.x"},
|
|
42
|
+
{title: "1.20.x", value: "1.20.x"},
|
|
43
|
+
{title: "1.19.x", value: "1.19.x"},
|
|
44
|
+
{title: "1.18.x", value: "1.18.x"},
|
|
45
|
+
{title: "1.17.x", value: "1.17.x"},
|
|
46
|
+
{title: "1.16.x", value: "1.16.x"},
|
|
47
|
+
{title: "1.15.x", value: "1.15.x"},
|
|
48
|
+
{title: "1.14.x", value: "1.14.x"},
|
|
49
|
+
{title: "1.13.x", value: "1.13.x"},
|
|
50
|
+
{title: "1.12.x", value: "1.12.x"},
|
|
51
|
+
{title: "1.11.x", value: "1.11.x"},
|
|
52
|
+
{title: "1.10.x", value: "1.10.x"},
|
|
53
|
+
{title: "1.9.x", value: "1.9.x"},
|
|
54
|
+
{title: "1.8.x", value: "1.8.x"},
|
|
55
|
+
{title: "1.7.x", value: "1.7.x"},
|
|
56
|
+
{title: "1.6.x", value: "1.6.x"},
|
|
57
|
+
{title: "1.5.x", value: "1.5.x"},
|
|
58
|
+
{title: "1.4.x", value: "1.4.x"},
|
|
59
|
+
{title: "1.3.x", value: "1.3.x"},
|
|
60
|
+
{title: "1.2.x", value: "1.2.x"},
|
|
61
|
+
{title: "1.1.x", value: "1.1.x"},
|
|
62
|
+
{title: "1.0.x", value: "1.0.x"},
|
|
63
|
+
{title: "snapshot", value: "snapshot"},
|
|
64
|
+
{title: "beta", value: "beta"},
|
|
65
|
+
{title: "alpha", value: "alpha"},
|
|
66
66
|
];
|
package/src/config/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
1
|
+
export * from "./constants.js";
|
|
2
|
+
export * from "./api.js";
|
|
3
|
+
export * from "./files.js";
|
|
4
|
+
export * from "./options.js";
|
|
5
|
+
export * from "./defaults.js";
|
|
6
|
+
export * from "./strings.js";
|
package/src/config/options.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import {logm} from "../logger.js";
|
|
2
|
+
|
|
1
3
|
/** Options for slugify */
|
|
2
4
|
export const SLUGIFY_OPTIONS = {
|
|
3
5
|
lower: true,
|
|
4
6
|
strict: true,
|
|
5
|
-
separator:
|
|
6
|
-
locale:
|
|
7
|
-
trim: true
|
|
7
|
+
separator: "-",
|
|
8
|
+
locale: "en",
|
|
9
|
+
trim: true,
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
/** Options for prompts */
|
|
11
13
|
export const PROMPTS_OPTIONS = {
|
|
12
14
|
onCancel: () => {
|
|
13
|
-
|
|
15
|
+
logm.warn("Modpack initialization was interrupted");
|
|
14
16
|
process.exit(1);
|
|
15
|
-
}
|
|
17
|
+
},
|
|
16
18
|
};
|