sandstone-cli 1.2.3 → 1.2.5

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.
@@ -68,6 +68,9 @@ export async function createCommand(_project, opts) {
68
68
  // Find the save directory
69
69
  const saveOptions = {};
70
70
  if (version[0].major === 1) {
71
+ if (opts.clientPath) {
72
+ saveOptions.clientPath = opts.clientPath;
73
+ }
71
74
  if (opts.root) {
72
75
  saveOptions.root = true;
73
76
  }
@@ -110,7 +113,7 @@ export async function createCommand(_project, opts) {
110
113
  name: 'world',
111
114
  message: 'What world do you want to save the packs in? >',
112
115
  type: 'list',
113
- choices: getWorldsList,
116
+ choices: () => getWorldsList(saveOptions.clientPath),
114
117
  });
115
118
  saveOptions.world = world;
116
119
  break;
@@ -125,9 +128,6 @@ export async function createCommand(_project, opts) {
125
128
  case 'none': break;
126
129
  }
127
130
  }
128
- if (opts.clientPath) {
129
- saveOptions.clientPath = opts.clientPath;
130
- }
131
131
  }
132
132
  let packageManager = 'npm';
133
133
  const yarn = hasYarn();
package/lib/utils.d.ts CHANGED
@@ -22,4 +22,4 @@ export declare const capitalize: (s: string) => string;
22
22
  * Get the .minecraft path
23
23
  */
24
24
  export declare function getMinecraftPath(): string;
25
- export declare function getWorldsList(): string[];
25
+ export declare function getWorldsList(clientPath?: string): string[];
package/lib/utils.js CHANGED
@@ -82,8 +82,8 @@ export function getMinecraftPath() {
82
82
  }
83
83
  return mcPath;
84
84
  }
85
- export function getWorldsList() {
86
- const mcPath = getMinecraftPath();
85
+ export function getWorldsList(clientPath) {
86
+ const mcPath = clientPath || getMinecraftPath();
87
87
  const savesPath = path.join(mcPath, 'saves');
88
88
  return fs.readdirSync(savesPath, { withFileTypes: true }).filter((f) => f.isDirectory).map((f) => f.name);
89
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandstone-cli",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "The CLI for Sandstone - the minecraft pack creation library.",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -103,6 +103,10 @@ export async function createCommand(_project: string, opts: CreateOptions) {
103
103
  } = {}
104
104
 
105
105
  if (version[0].major === 1) {
106
+ if (opts.clientPath) {
107
+ saveOptions.clientPath = opts.clientPath
108
+ }
109
+
106
110
  if (opts.root) {
107
111
  saveOptions.root = true
108
112
  } else if (opts.world) {
@@ -143,7 +147,7 @@ export async function createCommand(_project: string, opts: CreateOptions) {
143
147
  name: 'world',
144
148
  message: 'What world do you want to save the packs in? >',
145
149
  type: 'list',
146
- choices: getWorldsList,
150
+ choices: () => getWorldsList(saveOptions.clientPath),
147
151
  })
148
152
  saveOptions.world = world
149
153
  break
@@ -159,9 +163,6 @@ export async function createCommand(_project: string, opts: CreateOptions) {
159
163
  case 'none': break
160
164
  }
161
165
  }
162
- if (opts.clientPath) {
163
- saveOptions.clientPath = opts.clientPath
164
- }
165
166
  }
166
167
 
167
168
  let packageManager = 'npm'
package/src/shared.ts CHANGED
@@ -17,6 +17,6 @@ export const BuildDeclares = {
17
17
  serverPath: ['--server-path <path>', 'Path of the server folder. Override the value specified in the configuration file.'],
18
18
 
19
19
  // TODO: ssh
20
-
20
+
21
21
  enableSymlinks: ['--enable-symlinks', 'Force enable/disable symlinks. Defaults to false. Useful if you want to enable symlinks on Windows.'],
22
22
  } as unknown as Record<string, [string, string, RegExp, boolean]> // Haha TypeScript funny
package/src/utils.ts CHANGED
@@ -98,8 +98,8 @@ export function getMinecraftPath(): string {
98
98
  return mcPath
99
99
  }
100
100
 
101
- export function getWorldsList(): string[] {
102
- const mcPath = getMinecraftPath()
101
+ export function getWorldsList(clientPath?: string): string[] {
102
+ const mcPath = clientPath || getMinecraftPath()
103
103
  const savesPath = path.join(mcPath, 'saves')
104
104
 
105
105
  return fs.readdirSync(