modpack-lock 0.5.1 → 0.6.1
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 +1 -1
- package/src/cli.js +141 -120
- package/src/config/api.js +5 -5
- package/src/config/constants.js +11 -11
- 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 -361
- package/src/generate_readme.js +224 -0
- package/src/github_interactions.js +17 -23
- 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 +21 -17
package/package.json
CHANGED
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,84 @@ 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(
|
|
72
|
+
`License generation requires a ${config.MODPACK_JSON_NAME} file. Skipping license generation.`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Generate lockfile
|
|
77
|
+
const lockfile = await generateLockfile(currDir, options);
|
|
78
|
+
|
|
79
|
+
if (options.gitignore || options.readme) {
|
|
80
|
+
logm.header("Generating Optional Files");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Generate gitignore if requested
|
|
84
|
+
if (options.gitignore) {
|
|
85
|
+
await generateGitignoreRules(lockfile, currDir, options);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Generate README files if requested
|
|
89
|
+
if (options.readme) {
|
|
90
|
+
await generateReadmeFiles(lockfile, currDir, options);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
printLockfileSummary(lockfile);
|
|
100
94
|
}
|
|
101
95
|
} catch (error) {
|
|
102
|
-
|
|
96
|
+
logm.error(error);
|
|
103
97
|
process.exitCode = 1;
|
|
104
98
|
}
|
|
105
99
|
});
|
|
106
100
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
modpackLock
|
|
102
|
+
.command("init")
|
|
103
|
+
.description(
|
|
104
|
+
`Initialize a modpack with a ${config.MODPACK_JSON_NAME} file and a ${config.MODPACK_LOCKFILE_NAME} lockfile.`,
|
|
105
|
+
)
|
|
111
106
|
.optionsGroup(config.headings.options)
|
|
112
|
-
.option(
|
|
113
|
-
.option("-n, --noninteractive",
|
|
114
|
-
.option(
|
|
115
|
-
.option(
|
|
116
|
-
.option(
|
|
107
|
+
.option("-f, --folder <path>", "Path to the modpack directory")
|
|
108
|
+
.option("-n, --noninteractive", "Non-interactive mode - must provide options for required fields")
|
|
109
|
+
.option("--add-license", config.fileFields.addLicense.option)
|
|
110
|
+
.option("--add-gitignore", config.fileFields.addGitignore.option)
|
|
111
|
+
.option("--add-readme", config.fileFields.addReadme.option)
|
|
117
112
|
.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(
|
|
113
|
+
.option("--name <name>", config.infoFields.name.option)
|
|
114
|
+
.option("--version <version>", config.infoFields.version.option)
|
|
115
|
+
.option("--id <id>", config.infoFields.id.option)
|
|
116
|
+
.option("--description <description>", config.infoFields.description.option)
|
|
117
|
+
.option("--author <author>", config.infoFields.author.option)
|
|
118
|
+
.option("--projectUrl <projectUrl>", config.infoFields.projectUrl.option)
|
|
119
|
+
.option("--sourceUrl <sourceUrl>", config.infoFields.sourceUrl.option)
|
|
120
|
+
.option("--license <license>", config.infoFields.license.option)
|
|
121
|
+
.option("--modloader <modloader>", config.infoFields.modloader.option)
|
|
122
|
+
.option("--targetModloaderVersion <targetModloaderVersion>", config.infoFields.targetModloaderVersion.option)
|
|
123
|
+
.option("--targetMinecraftVersion <targetMinecraftVersion>", config.infoFields.targetMinecraftVersion.option)
|
|
129
124
|
.optionsGroup(config.headings.information)
|
|
130
125
|
.helpOption("-h, --help", `display help for ${pkg.name} init`)
|
|
131
126
|
.action(async (options) => {
|
|
@@ -135,9 +130,13 @@ modpackLock.command('init')
|
|
|
135
130
|
let existingInfo = await getModpackInfo(currDir);
|
|
136
131
|
|
|
137
132
|
if (options.noninteractive) {
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
|
|
133
|
+
logm.quiet();
|
|
134
|
+
if (
|
|
135
|
+
(!options.author && !existingInfo?.author) ||
|
|
136
|
+
(!options.modloader && !existingInfo?.modloader) ||
|
|
137
|
+
(!options.targetMinecraftVersion && !existingInfo?.targetMinecraftVersion)
|
|
138
|
+
) {
|
|
139
|
+
logm.error("Must provide options for required fields");
|
|
141
140
|
process.exitCode = 1;
|
|
142
141
|
return;
|
|
143
142
|
} else {
|
|
@@ -146,38 +145,57 @@ modpackLock.command('init')
|
|
|
146
145
|
name: defaultName,
|
|
147
146
|
version: config.DEFAULT_MODPACK_VERSION,
|
|
148
147
|
id: defaultName,
|
|
149
|
-
description:
|
|
148
|
+
description: "",
|
|
150
149
|
author: options.author, // Required, no default
|
|
151
|
-
projectUrl:
|
|
152
|
-
sourceUrl:
|
|
153
|
-
license:
|
|
150
|
+
projectUrl: "",
|
|
151
|
+
sourceUrl: "",
|
|
152
|
+
license: "",
|
|
154
153
|
modloader: options.modloader, // Required, no default
|
|
155
|
-
targetModloaderVersion:
|
|
154
|
+
targetModloaderVersion: "",
|
|
156
155
|
targetMinecraftVersion: options.targetMinecraftVersion, // Required, no default
|
|
157
156
|
};
|
|
158
157
|
|
|
159
158
|
const modpackInfo = mergeModpackInfo(existingInfo, options, defaults);
|
|
160
159
|
modpackInfo.id = slugify(modpackInfo.id, config.SLUGIFY_OPTIONS);
|
|
161
160
|
|
|
162
|
-
if (options.addLicense) {
|
|
163
|
-
await generateLicense(modpackInfo, currDir, options);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
161
|
options.readme = options.addReadme;
|
|
167
162
|
options.gitignore = options.addGitignore;
|
|
163
|
+
options.licenseFile = options.addLicense;
|
|
168
164
|
|
|
169
165
|
// generate the modpack files
|
|
170
166
|
try {
|
|
171
167
|
await generateModpackFiles(modpackInfo, currDir, options);
|
|
172
168
|
} catch (error) {
|
|
173
|
-
|
|
169
|
+
logm.error(error);
|
|
174
170
|
process.exitCode = 1;
|
|
175
171
|
}
|
|
176
172
|
}
|
|
177
173
|
} else {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
logm.info(logm.label("modpack-lock"), styleText(["bold", "italic", "blueBright"], "init"));
|
|
175
|
+
logm.newline();
|
|
176
|
+
logm.info(
|
|
177
|
+
styleText(["dim"], "This utility will walk you through creating a"),
|
|
178
|
+
config.MODPACK_JSON_NAME,
|
|
179
|
+
styleText(["dim"], "file and a"),
|
|
180
|
+
config.MODPACK_LOCKFILE_NAME,
|
|
181
|
+
styleText(
|
|
182
|
+
["dim"],
|
|
183
|
+
"lockfile. It only covers the most common items, and tries to guess sensible defaults.",
|
|
184
|
+
),
|
|
185
|
+
);
|
|
186
|
+
logm.newline();
|
|
187
|
+
logm.info(
|
|
188
|
+
styleText(["dim"], "See"),
|
|
189
|
+
styleText(["white", "bgGray", "italic"], "modpack-lock init --help"),
|
|
190
|
+
styleText(["dim"], "for definitive documentation on these fields and exactly what they do."),
|
|
191
|
+
);
|
|
192
|
+
logm.newline();
|
|
193
|
+
logm.info(
|
|
194
|
+
styleText(["dim"], "Press"),
|
|
195
|
+
styleText(["yellow"], "^C"),
|
|
196
|
+
styleText(["dim"], "at any time to quit."),
|
|
197
|
+
);
|
|
198
|
+
logm.newline();
|
|
181
199
|
try {
|
|
182
200
|
const defaults = {
|
|
183
201
|
name: path.basename(currDir),
|
|
@@ -192,37 +210,40 @@ modpackLock.command('init')
|
|
|
192
210
|
targetModloaderVersion: undefined,
|
|
193
211
|
targetMinecraftVersion: undefined,
|
|
194
212
|
};
|
|
213
|
+
const mergedDefaults = mergeModpackInfo(existingInfo, options, defaults);
|
|
195
214
|
|
|
196
215
|
// prompt user for modpack information
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
)
|
|
216
|
+
const userAnswers = await promptUserForInfo(mergedDefaults);
|
|
217
|
+
|
|
218
|
+
// Preserve extra fields (e.g. scripts) from existing modpack.json
|
|
219
|
+
const modpackInfo = {...mergedDefaults, ...userAnswers};
|
|
200
220
|
|
|
201
221
|
// prompt user if they want to add the license text
|
|
202
222
|
const optionalFiles = await promptUserAboutOptionalFiles(modpackInfo, options);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
await generateLicense(modpackInfo, currDir, options);
|
|
206
|
-
}
|
|
207
|
-
console.log();
|
|
223
|
+
|
|
224
|
+
logm.newline();
|
|
208
225
|
|
|
209
226
|
// generate the modpack files
|
|
210
227
|
options.readme = optionalFiles.addReadme;
|
|
211
228
|
options.gitignore = optionalFiles.addGitignore;
|
|
212
|
-
|
|
229
|
+
options.licenseFile = optionalFiles.addLicense;
|
|
230
|
+
const lockfile = await generateModpackFiles(modpackInfo, currDir, options);
|
|
231
|
+
|
|
232
|
+
printLockfileSummary(lockfile);
|
|
213
233
|
} catch (error) {
|
|
214
|
-
|
|
234
|
+
logm.error(error);
|
|
215
235
|
process.exitCode = 1;
|
|
216
236
|
}
|
|
217
237
|
}
|
|
218
238
|
});
|
|
219
239
|
|
|
220
|
-
modpackLock
|
|
240
|
+
modpackLock
|
|
241
|
+
.command("run")
|
|
221
242
|
.description(`Run a script defined in the ${config.MODPACK_JSON_NAME} file's 'scripts' field`)
|
|
222
|
-
.argument(
|
|
243
|
+
.argument("<script>", "The name of the script to run")
|
|
223
244
|
.optionsGroup(config.headings.options)
|
|
224
|
-
.option(
|
|
225
|
-
.option(
|
|
245
|
+
.option("-f, --folder <path>", "Path to the modpack directory")
|
|
246
|
+
.option("-D, --debug", "Debug mode -- show more information about how the command is being parsed")
|
|
226
247
|
.optionsGroup(config.headings.information)
|
|
227
248
|
.helpOption("-h, --help", `display help for ${pkg.name} run`)
|
|
228
249
|
.allowExcessArguments(true)
|
|
@@ -231,7 +252,7 @@ modpackLock.command('run')
|
|
|
231
252
|
options._run = true;
|
|
232
253
|
try {
|
|
233
254
|
if (options.debug) {
|
|
234
|
-
|
|
255
|
+
logm.debug("COMMAND:", command);
|
|
235
256
|
}
|
|
236
257
|
|
|
237
258
|
const currDir = options.folder || process.cwd();
|
|
@@ -251,39 +272,39 @@ modpackLock.command('run')
|
|
|
251
272
|
// build the full command
|
|
252
273
|
const scriptCommand = modpackInfo.scripts[script];
|
|
253
274
|
const args = command.args ? command.args.slice(1) : [];
|
|
254
|
-
const fullCommand = `${scriptCommand} ${args.join(
|
|
275
|
+
const fullCommand = `${scriptCommand} ${args.join(" ")}`;
|
|
255
276
|
|
|
256
277
|
// debug logging
|
|
257
278
|
if (options.debug) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
279
|
+
logm.debug("CURR DIR:", currDir);
|
|
280
|
+
logm.debug("OPTIONS:", options);
|
|
281
|
+
logm.debug("SCRIPT:", script);
|
|
282
|
+
logm.debug("SCRIPT COMMAND:", scriptCommand);
|
|
283
|
+
logm.debug("ARGS:", args);
|
|
284
|
+
logm.debug("FULL COMMAND:", fullCommand);
|
|
264
285
|
}
|
|
265
286
|
|
|
266
287
|
// spawn the command
|
|
267
288
|
const child = spawn(fullCommand, [], {
|
|
268
289
|
shell: true,
|
|
269
|
-
stdio:
|
|
270
|
-
cwd: currDir
|
|
290
|
+
stdio: "inherit",
|
|
291
|
+
cwd: currDir,
|
|
271
292
|
});
|
|
272
293
|
|
|
273
294
|
// preserve exit code on completion
|
|
274
295
|
const exitCode = await new Promise((resolve) => {
|
|
275
|
-
child.on(
|
|
296
|
+
child.on("close", (code) => {
|
|
276
297
|
resolve(code || 0);
|
|
277
298
|
});
|
|
278
299
|
});
|
|
279
300
|
process.exitCode = exitCode;
|
|
280
301
|
} catch (error) {
|
|
281
|
-
|
|
302
|
+
logm.error(error.message);
|
|
282
303
|
process.exitCode = 1;
|
|
283
304
|
}
|
|
284
305
|
});
|
|
285
306
|
|
|
286
307
|
modpackLock.parseAsync().catch((error) => {
|
|
287
|
-
|
|
308
|
+
logm.error(error);
|
|
288
309
|
process.exit(1);
|
|
289
310
|
});
|
package/src/config/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import pkg from
|
|
2
|
-
import * as constants from
|
|
1
|
+
import pkg from "../../package.json" with {type: "json"};
|
|
2
|
+
import * as constants from "./constants.js";
|
|
3
3
|
|
|
4
4
|
/** User-Agent header for Modrinth API requests */
|
|
5
5
|
export const PACKAGE_USER_AGENT = `${constants.AUTHOR_USERNAME}/${pkg.name}/${pkg.version}`;
|
|
6
6
|
|
|
7
7
|
/** Modrinth API base URL */
|
|
8
|
-
export const MODRINTH_API_BASE =
|
|
8
|
+
export const MODRINTH_API_BASE = "https://api.modrinth.com/v2";
|
|
9
9
|
|
|
10
10
|
/** Modrinth version files endpoint */
|
|
11
11
|
export const MODRINTH_VERSION_FILES_ENDPOINT = `${MODRINTH_API_BASE}/version_files`;
|
|
@@ -26,7 +26,7 @@ export const MODRINTH_MODLOADERS_ENDPOINT = `${MODRINTH_API_BASE}/tag/loader`;
|
|
|
26
26
|
export const BATCH_SIZE = 100;
|
|
27
27
|
|
|
28
28
|
/** GitHub API base URL */
|
|
29
|
-
export const GITHUB_API_BASE =
|
|
29
|
+
export const GITHUB_API_BASE = "https://api.github.com";
|
|
30
30
|
|
|
31
31
|
/** GitHub licenses endpoint */
|
|
32
32
|
export const GITHUB_LICENSES_ENDPOINT = `${GITHUB_API_BASE}/licenses`;
|
|
@@ -38,4 +38,4 @@ export const GITHUB_FEATURED_LICENSES_ENDPOINT = `${GITHUB_LICENSES_ENDPOINT}?fe
|
|
|
38
38
|
export const GITHUB_LICENSE_ENDPOINT = (license) => `${GITHUB_API_BASE}/licenses/${license}`;
|
|
39
39
|
|
|
40
40
|
/** GitHub Accept request header */
|
|
41
|
-
export const GITHUB_ACCEPT_HEADER =
|
|
41
|
+
export const GITHUB_ACCEPT_HEADER = "application/vnd.github+json";
|
package/src/config/constants.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import pkg from
|
|
1
|
+
import pkg from "../../package.json" with {type: "json"};
|
|
2
2
|
|
|
3
3
|
/** Author username */
|
|
4
|
-
export const AUTHOR_USERNAME =
|
|
4
|
+
export const AUTHOR_USERNAME = "nickesc";
|
|
5
5
|
|
|
6
6
|
/** Lockfile format version -- increment on changes to the format */
|
|
7
7
|
export const LOCKFILE_VERSION = "1.0.1";
|
|
8
8
|
|
|
9
9
|
/** Required fields for the modpack information */
|
|
10
10
|
export const MODPACK_INFO_REQUIRED_FIELDS = [
|
|
11
|
-
"name",
|
|
11
|
+
"name", //
|
|
12
12
|
"version",
|
|
13
13
|
"id",
|
|
14
14
|
"author",
|
|
15
15
|
"modloader",
|
|
16
|
-
"targetMinecraftVersion"
|
|
16
|
+
"targetMinecraftVersion",
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
/** Dependency categories, corresponds to folders in Minecraft profile */
|
|
20
20
|
export const DEPENDENCY_CATEGORIES = [
|
|
21
|
-
"mods",
|
|
21
|
+
"mods", //
|
|
22
22
|
"resourcepacks",
|
|
23
23
|
"shaderpacks",
|
|
24
|
-
"datapacks"
|
|
24
|
+
"datapacks",
|
|
25
25
|
];
|
|
26
26
|
|
|
27
27
|
/** Minecraft version types */
|
|
28
28
|
export const MINECRAFT_VERSION_TYPES = [
|
|
29
|
-
"release",
|
|
29
|
+
"release", //
|
|
30
30
|
"alpha",
|
|
31
31
|
"beta",
|
|
32
|
-
"snapshot"
|
|
32
|
+
"snapshot",
|
|
33
33
|
];
|
|
34
34
|
|
|
35
|
-
const gitignoreMarker = (mode) =>
|
|
35
|
+
const gitignoreMarker = (mode) => `# ${pkg.name}:${mode}`;
|
|
36
36
|
|
|
37
37
|
/** Gitignore section start marker */
|
|
38
|
-
export const GITIGNORE_START_MARKER = gitignoreMarker(
|
|
38
|
+
export const GITIGNORE_START_MARKER = gitignoreMarker("start");
|
|
39
39
|
|
|
40
40
|
/** Gitignore section end marker */
|
|
41
|
-
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
|
};
|