modpack-lock 0.6.0 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +28 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modpack-lock",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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"
package/src/cli.js CHANGED
@@ -68,7 +68,9 @@ modpackLock
68
68
  } else {
69
69
  // Warn if license option is passed but no modpack.json exists
70
70
  if (options.licenseFile) {
71
- logm.warn(`License generation requires a ${config.MODPACK_JSON_NAME} file. Skipping license generation.`);
71
+ logm.warn(
72
+ `License generation requires a ${config.MODPACK_JSON_NAME} file. Skipping license generation.`,
73
+ );
72
74
  }
73
75
 
74
76
  // Generate lockfile
@@ -98,7 +100,9 @@ modpackLock
98
100
 
99
101
  modpackLock
100
102
  .command("init")
101
- .description(`Initialize a modpack with a ${config.MODPACK_JSON_NAME} file and a ${config.MODPACK_LOCKFILE_NAME} lockfile.`)
103
+ .description(
104
+ `Initialize a modpack with a ${config.MODPACK_JSON_NAME} file and a ${config.MODPACK_LOCKFILE_NAME} lockfile.`,
105
+ )
102
106
  .optionsGroup(config.headings.options)
103
107
  .option("-f, --folder <path>", "Path to the modpack directory")
104
108
  .option("-n, --noninteractive", "Non-interactive mode - must provide options for required fields")
@@ -169,16 +173,28 @@ modpackLock
169
173
  } else {
170
174
  logm.info(logm.label("modpack-lock"), styleText(["bold", "italic", "blueBright"], "init"));
171
175
  logm.newline();
172
- logm.info(styleText(["dim"], "This utility will walk you through creating a"),
173
- config.MODPACK_JSON_NAME,
176
+ logm.info(
177
+ styleText(["dim"], "This utility will walk you through creating a"),
178
+ config.MODPACK_JSON_NAME,
174
179
  styleText(["dim"], "file and a"),
175
180
  config.MODPACK_LOCKFILE_NAME,
176
- styleText(["dim"], "lockfile. It only covers the most common items, and tries to guess sensible defaults."),
181
+ styleText(
182
+ ["dim"],
183
+ "lockfile. It only covers the most common items, and tries to guess sensible defaults.",
184
+ ),
177
185
  );
178
186
  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."));
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
+ );
180
192
  logm.newline();
181
- logm.info(styleText(["dim"], "Press"), styleText(["yellow"], "^C"), styleText(["dim"], "at any time to quit."));
193
+ logm.info(
194
+ styleText(["dim"], "Press"),
195
+ styleText(["yellow"], "^C"),
196
+ styleText(["dim"], "at any time to quit."),
197
+ );
182
198
  logm.newline();
183
199
  try {
184
200
  const defaults = {
@@ -194,9 +210,13 @@ modpackLock
194
210
  targetModloaderVersion: undefined,
195
211
  targetMinecraftVersion: undefined,
196
212
  };
213
+ const mergedDefaults = mergeModpackInfo(existingInfo, options, defaults);
197
214
 
198
215
  // prompt user for modpack information
199
- const modpackInfo = await promptUserForInfo(mergeModpackInfo(existingInfo, options, defaults));
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);