sandstone-cli 1.2.1 → 1.2.2
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/lib/commands/create.js +28 -23
- package/package.json +1 -1
- package/src/commands/create.ts +30 -25
package/lib/commands/create.js
CHANGED
|
@@ -82,9 +82,9 @@ export async function createCommand(_project, opts) {
|
|
|
82
82
|
const { saveChoice } = await inquirer.prompt({
|
|
83
83
|
name: 'saveChoice',
|
|
84
84
|
type: 'list',
|
|
85
|
-
message: 'Where do you want your pack(s) to be
|
|
85
|
+
message: 'Where do you want your pack(s) to be exported to (can be changed later)?',
|
|
86
86
|
choices: [{
|
|
87
|
-
name: 'In the root client (.minecraft) folder',
|
|
87
|
+
name: 'In the root client (.minecraft/datapacks & .minecraft/resourcepacks) folder(s)',
|
|
88
88
|
value: 'root',
|
|
89
89
|
short: 'Client folder',
|
|
90
90
|
}, {
|
|
@@ -95,27 +95,34 @@ export async function createCommand(_project, opts) {
|
|
|
95
95
|
name: 'In a server',
|
|
96
96
|
value: 'server-path',
|
|
97
97
|
short: 'Server path',
|
|
98
|
+
}, {
|
|
99
|
+
name: 'N/A',
|
|
100
|
+
value: 'none',
|
|
101
|
+
short: 'None',
|
|
98
102
|
}],
|
|
99
103
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
switch (saveChoice) {
|
|
105
|
+
case 'root':
|
|
106
|
+
saveOptions.root = true;
|
|
107
|
+
break;
|
|
108
|
+
case 'world':
|
|
109
|
+
const { world } = await inquirer.prompt({
|
|
110
|
+
name: 'world',
|
|
111
|
+
message: 'What world do you want to save the packs in? >',
|
|
112
|
+
type: 'list',
|
|
113
|
+
choices: getWorldsList,
|
|
114
|
+
});
|
|
115
|
+
saveOptions.world = world;
|
|
116
|
+
break;
|
|
117
|
+
case 'server-path':
|
|
118
|
+
const { serverPath } = await inquirer.prompt({
|
|
119
|
+
name: 'serverPath',
|
|
120
|
+
message: 'Where is the server to save the packs in? Relative paths are accepted. >',
|
|
121
|
+
type: 'input',
|
|
122
|
+
});
|
|
123
|
+
saveOptions.serverPath = serverPath;
|
|
124
|
+
break;
|
|
125
|
+
case 'none': break;
|
|
119
126
|
}
|
|
120
127
|
}
|
|
121
128
|
if (opts.clientPath) {
|
|
@@ -146,7 +153,6 @@ export async function createCommand(_project, opts) {
|
|
|
146
153
|
exec(`git checkout ${projectType}-${version[0]}`);
|
|
147
154
|
exec('npx rimraf -rf .git');
|
|
148
155
|
exec(`${packageManager} install`);
|
|
149
|
-
// TODO: Make profiles for either packs or libraries
|
|
150
156
|
const configPath = path.join(projectPath, `${projectType === 'library' ? 'test/' : ''}sandstone.config.ts`);
|
|
151
157
|
// Merge with the config values
|
|
152
158
|
let templateConfig = await fs.readFile(configPath, 'utf8');
|
|
@@ -155,7 +161,6 @@ export async function createCommand(_project, opts) {
|
|
|
155
161
|
templateConfig = templateConfig.replace('namespace: \'default\'', `namespace: ${toJson(namespace)}`);
|
|
156
162
|
// TODO: packFormat
|
|
157
163
|
const optsJson = toJson(Object.fromEntries(Object.entries(saveOptions).filter(([_, value]) => value !== undefined)));
|
|
158
|
-
console.log(saveOptions, optsJson);
|
|
159
164
|
if (optsJson !== '{}') {
|
|
160
165
|
templateConfig = templateConfig.replace('saveOptions: {}', `saveOptions: ${optsJson}`);
|
|
161
166
|
}
|
package/package.json
CHANGED
package/src/commands/create.ts
CHANGED
|
@@ -111,12 +111,12 @@ export async function createCommand(_project: string, opts: CreateOptions) {
|
|
|
111
111
|
saveOptions.serverPath = opts.serverPath
|
|
112
112
|
} else { // TODO: Add support for ssh
|
|
113
113
|
// User didn't specify a way to save the file. Ask them.
|
|
114
|
-
const { saveChoice }: { saveChoice: 'root' | 'world' | 'server-path' } = await inquirer.prompt({
|
|
114
|
+
const { saveChoice }: { saveChoice: 'root' | 'world' | 'server-path' | 'none' } = await inquirer.prompt({
|
|
115
115
|
name: 'saveChoice',
|
|
116
116
|
type: 'list',
|
|
117
|
-
message: 'Where do you want your pack(s) to be
|
|
117
|
+
message: 'Where do you want your pack(s) to be exported to (can be changed later)?',
|
|
118
118
|
choices: [{
|
|
119
|
-
name: 'In the root client (.minecraft) folder',
|
|
119
|
+
name: 'In the root client (.minecraft/datapacks & .minecraft/resourcepacks) folder(s)',
|
|
120
120
|
value: 'root',
|
|
121
121
|
short: 'Client folder',
|
|
122
122
|
}, {
|
|
@@ -127,27 +127,36 @@ export async function createCommand(_project: string, opts: CreateOptions) {
|
|
|
127
127
|
name: 'In a server',
|
|
128
128
|
value: 'server-path',
|
|
129
129
|
short: 'Server path',
|
|
130
|
+
}, {
|
|
131
|
+
name: 'N/A',
|
|
132
|
+
value: 'none',
|
|
133
|
+
short: 'None',
|
|
130
134
|
}],
|
|
131
135
|
})
|
|
132
136
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
137
|
+
switch (saveChoice) {
|
|
138
|
+
case 'root':
|
|
139
|
+
saveOptions.root = true
|
|
140
|
+
break
|
|
141
|
+
case 'world':
|
|
142
|
+
const { world }: { world: string } = await inquirer.prompt({
|
|
143
|
+
name: 'world',
|
|
144
|
+
message: 'What world do you want to save the packs in? >',
|
|
145
|
+
type: 'list',
|
|
146
|
+
choices: getWorldsList,
|
|
147
|
+
})
|
|
148
|
+
saveOptions.world = world
|
|
149
|
+
break
|
|
150
|
+
case 'server-path':
|
|
151
|
+
const { serverPath }: { serverPath: string } = await inquirer.prompt({
|
|
152
|
+
name: 'serverPath',
|
|
153
|
+
message: 'Where is the server to save the packs in? Relative paths are accepted. >',
|
|
154
|
+
type: 'input',
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
saveOptions.serverPath = serverPath
|
|
158
|
+
break
|
|
159
|
+
case 'none': break
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
if (opts.clientPath) {
|
|
@@ -189,8 +198,6 @@ export async function createCommand(_project: string, opts: CreateOptions) {
|
|
|
189
198
|
|
|
190
199
|
exec(`${packageManager} install`)
|
|
191
200
|
|
|
192
|
-
// TODO: Make profiles for either packs or libraries
|
|
193
|
-
|
|
194
201
|
const configPath = path.join(projectPath, `${projectType === 'library' ? 'test/' : ''}sandstone.config.ts`)
|
|
195
202
|
|
|
196
203
|
// Merge with the config values
|
|
@@ -206,8 +213,6 @@ export async function createCommand(_project: string, opts: CreateOptions) {
|
|
|
206
213
|
|
|
207
214
|
const optsJson = toJson(Object.fromEntries(Object.entries(saveOptions).filter(([_, value]) => value !== undefined)))
|
|
208
215
|
|
|
209
|
-
console.log(saveOptions, optsJson)
|
|
210
|
-
|
|
211
216
|
if (optsJson !== '{}') {
|
|
212
217
|
templateConfig = templateConfig.replace('saveOptions: {}', `saveOptions: ${optsJson}`)
|
|
213
218
|
}
|