modpack-lock 0.3.0 → 0.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "modpack-lock",
3
- "version": "0.3.0",
3
+ "version": "0.3.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
@@ -112,10 +112,11 @@ modpackLock.command('init')
112
112
  process.exitCode = 1;
113
113
  return;
114
114
  } else {
115
+ const name = options.name || path.basename(currDir);
115
116
  const modpackInfo = {
116
- name: options.name || path.basename(currDir),
117
+ name: name,
117
118
  version: options.version || '1.0.0',
118
- id: slugify(options.id || options.name || path.basename(currDir), config.SLUGIFY_OPTIONS),
119
+ id: slugify(options.id || name, config.SLUGIFY_OPTIONS),
119
120
  description: options.description || '',
120
121
  author: options.author,
121
122
  projectUrl: options.projectUrl || '',
@@ -24,16 +24,16 @@ function validateNotEmpty(value, field) {
24
24
  * @returns {Promise<ModpackInfo>} The modpack information from the user
25
25
  */
26
26
  export default async function promptUserForInfo(defaults = {}) {
27
- let answers = await prompts([
28
- {
29
- type: 'text',
30
- name: 'name',
31
- message: 'Modpack name',
32
- initial: defaults.name,
33
- validate: (value) => {
34
- return validateNotEmpty(value, 'Name');
35
- },
27
+ let name = await prompts({
28
+ type: 'text',
29
+ name: 'name',
30
+ message: 'Modpack name',
31
+ initial: defaults.name,
32
+ validate: (value) => {
33
+ return validateNotEmpty(value, 'Name');
36
34
  },
35
+ });
36
+ let answers = await prompts([
37
37
  {
38
38
  type: 'text',
39
39
  name: 'version',
@@ -48,7 +48,7 @@ export default async function promptUserForInfo(defaults = {}) {
48
48
  type: 'text',
49
49
  name: 'id',
50
50
  message: 'Modpack slug/ID',
51
- initial: slugify(defaults.id || defaults.name, config.SLUGIFY_OPTIONS),
51
+ initial: slugify(defaults.id || name.name, config.SLUGIFY_OPTIONS),
52
52
  validate: (value) => {
53
53
  return validateNotEmpty(value, 'ID');
54
54
  },
@@ -126,9 +126,11 @@ export default async function promptUserForInfo(defaults = {}) {
126
126
  },
127
127
  }
128
128
  ]);
129
- if (Object.keys(answers).length < 11) {
129
+
130
+ let modpackInfo = {...name, ...answers};
131
+ if (Object.keys(modpackInfo).length < 11) {
130
132
  console.warn('Modpack initialization was interrupted');
131
133
  process.exit(1);
132
134
  }
133
- return answers;
135
+ return modpackInfo;
134
136
  }