sandstone-cli 1.2.2 → 1.2.4
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 +1 -1
- package/lib/commands/watch.js +1 -0
- package/lib/index.js +3 -1
- package/lib/shared.js +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +2 -2
- package/package.json +1 -1
- package/src/commands/create.ts +1 -1
- package/src/commands/watch.ts +2 -0
- package/src/index.ts +4 -0
- package/src/shared.ts +3 -1
- package/src/utils.ts +2 -2
package/lib/commands/create.js
CHANGED
|
@@ -110,7 +110,7 @@ export async function createCommand(_project, opts) {
|
|
|
110
110
|
name: 'world',
|
|
111
111
|
message: 'What world do you want to save the packs in? >',
|
|
112
112
|
type: 'list',
|
|
113
|
-
choices: getWorldsList,
|
|
113
|
+
choices: () => getWorldsList(saveOptions.clientPath),
|
|
114
114
|
});
|
|
115
115
|
saveOptions.world = world;
|
|
116
116
|
break;
|
package/lib/commands/watch.js
CHANGED
|
@@ -5,6 +5,7 @@ import { buildCommand } from './build.js';
|
|
|
5
5
|
export async function watchCommand(opts) {
|
|
6
6
|
let alreadyBuilding = false;
|
|
7
7
|
let needRebuild = false;
|
|
8
|
+
// TODO: reimplement auto reload
|
|
8
9
|
// let client: Client | null = null
|
|
9
10
|
// TODO: add support for clients & resources that require restarts & world resets, sandstone-server should override the involved environment variables if mods are present that fix it
|
|
10
11
|
/*if (flags.autoReload !== undefined) {
|
package/lib/index.js
CHANGED
|
@@ -24,6 +24,7 @@ build.option.apply(build, BuildDeclares.dry)
|
|
|
24
24
|
.option.apply(build, BuildDeclares.world)
|
|
25
25
|
.option.apply(build, BuildDeclares.clientPath)
|
|
26
26
|
.option.apply(build, BuildDeclares.serverPath)
|
|
27
|
+
.option.apply(build, BuildDeclares.enableSymlinks)
|
|
27
28
|
.action(buildCommand);
|
|
28
29
|
const watch = CLI
|
|
29
30
|
.command('watch')
|
|
@@ -40,7 +41,8 @@ watch.option.apply(watch, BuildDeclares.dry)
|
|
|
40
41
|
.option.apply(watch, BuildDeclares.namespace)
|
|
41
42
|
.option.apply(watch, BuildDeclares.world)
|
|
42
43
|
.option.apply(watch, BuildDeclares.clientPath)
|
|
43
|
-
.option.apply(watch, BuildDeclares.serverPath)
|
|
44
|
+
.option.apply(watch, BuildDeclares.serverPath)
|
|
45
|
+
.option.apply(watch, BuildDeclares.enableSymlinks);
|
|
44
46
|
const create = CLI
|
|
45
47
|
.command('create')
|
|
46
48
|
.description('Create a new Sandstone project. ⛏')
|
package/lib/shared.js
CHANGED
|
@@ -15,5 +15,5 @@ export const BuildDeclares = {
|
|
|
15
15
|
clientPath: ['-c, --client-path <path>', 'Path of the client folder. Override the value specified in the configuration file.'],
|
|
16
16
|
serverPath: ['--server-path <path>', 'Path of the server folder. Override the value specified in the configuration file.'],
|
|
17
17
|
// TODO: ssh
|
|
18
|
-
|
|
18
|
+
enableSymlinks: ['--enable-symlinks', 'Force enable/disable symlinks. Defaults to false. Useful if you want to enable symlinks on Windows.'],
|
|
19
19
|
}; // Haha TypeScript funny
|
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
package/src/commands/create.ts
CHANGED
|
@@ -143,7 +143,7 @@ export async function createCommand(_project: string, opts: CreateOptions) {
|
|
|
143
143
|
name: 'world',
|
|
144
144
|
message: 'What world do you want to save the packs in? >',
|
|
145
145
|
type: 'list',
|
|
146
|
-
choices: getWorldsList,
|
|
146
|
+
choices: () => getWorldsList(saveOptions.clientPath),
|
|
147
147
|
})
|
|
148
148
|
saveOptions.world = world
|
|
149
149
|
break
|
package/src/commands/watch.ts
CHANGED
|
@@ -28,6 +28,8 @@ export async function watchCommand(opts: WatchOptions) {
|
|
|
28
28
|
let alreadyBuilding: boolean = false
|
|
29
29
|
let needRebuild: boolean = false
|
|
30
30
|
|
|
31
|
+
// TODO: reimplement auto reload
|
|
32
|
+
|
|
31
33
|
// let client: Client | null = null
|
|
32
34
|
|
|
33
35
|
// TODO: add support for clients & resources that require restarts & world resets, sandstone-server should override the involved environment variables if mods are present that fix it
|
package/src/index.ts
CHANGED
|
@@ -30,6 +30,8 @@ build.option.apply(build, BuildDeclares.dry)
|
|
|
30
30
|
.option.apply(build, BuildDeclares.world)
|
|
31
31
|
.option.apply(build, BuildDeclares.clientPath)
|
|
32
32
|
.option.apply(build, BuildDeclares.serverPath)
|
|
33
|
+
|
|
34
|
+
.option.apply(build, BuildDeclares.enableSymlinks)
|
|
33
35
|
.action(buildCommand)
|
|
34
36
|
|
|
35
37
|
const watch = CLI
|
|
@@ -50,6 +52,8 @@ watch.option.apply(watch, BuildDeclares.dry)
|
|
|
50
52
|
.option.apply(watch, BuildDeclares.world)
|
|
51
53
|
.option.apply(watch, BuildDeclares.clientPath)
|
|
52
54
|
.option.apply(watch, BuildDeclares.serverPath)
|
|
55
|
+
|
|
56
|
+
.option.apply(watch, BuildDeclares.enableSymlinks)
|
|
53
57
|
|
|
54
58
|
const create = CLI
|
|
55
59
|
.command('create')
|
package/src/shared.ts
CHANGED
|
@@ -15,6 +15,8 @@ export const BuildDeclares = {
|
|
|
15
15
|
world: ['-w, --world <name>', 'The name of the world to save the packs in. Override the value specified in the configuration file.'],
|
|
16
16
|
clientPath: ['-c, --client-path <path>', 'Path of the client folder. Override the value specified in the configuration file.'],
|
|
17
17
|
serverPath: ['--server-path <path>', 'Path of the server folder. Override the value specified in the configuration file.'],
|
|
18
|
+
|
|
18
19
|
// TODO: ssh
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
enableSymlinks: ['--enable-symlinks', 'Force enable/disable symlinks. Defaults to false. Useful if you want to enable symlinks on Windows.'],
|
|
20
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(
|