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 +1 -1
- package/src/cli.js +3 -2
- package/src/modpack_info.js +14 -12
package/package.json
CHANGED
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:
|
|
117
|
+
name: name,
|
|
117
118
|
version: options.version || '1.0.0',
|
|
118
|
-
id: slugify(options.id ||
|
|
119
|
+
id: slugify(options.id || name, config.SLUGIFY_OPTIONS),
|
|
119
120
|
description: options.description || '',
|
|
120
121
|
author: options.author,
|
|
121
122
|
projectUrl: options.projectUrl || '',
|
package/src/modpack_info.js
CHANGED
|
@@ -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
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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 ||
|
|
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
|
-
|
|
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
|
|
135
|
+
return modpackInfo;
|
|
134
136
|
}
|