sandstone-cli 1.1.10 → 1.2.0
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/.github/workflows/npm-publish.yml +4 -0
- package/README.md +1 -1
- package/lib/commands/create.js +1 -1
- package/lib/commands/dependency.js +20 -1
- package/lib/create.d.ts +2 -0
- package/lib/create.js +18 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -2
- package/package.json +4 -3
- package/src/commands/create.ts +1 -1
- package/src/commands/dependency.ts +24 -1
- package/src/create.ts +24 -0
- package/src/index.ts +1 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
sandstone-cli
|
|
2
2
|
=============
|
|
3
3
|
|
|
4
|
-
The CLI for Sandstone - the
|
|
4
|
+
The CLI for Sandstone - the minecraft pack creation library.
|
|
5
5
|
|
|
6
6
|
[](https://npmjs.org/package/sandstone-cli)
|
|
7
7
|
[](https://npmjs.org/package/sandstone-cli)
|
package/lib/commands/create.js
CHANGED
|
@@ -26,7 +26,7 @@ export async function createCommand(_project, opts) {
|
|
|
26
26
|
default: false,
|
|
27
27
|
})).projectType) === true ? 'library' : 'pack';
|
|
28
28
|
const sv = (v) => new SemVer(v);
|
|
29
|
-
const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('
|
|
29
|
+
const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('1.0.0-beta.0'), sv('1.1.11')]];
|
|
30
30
|
const stableIndex = 0;
|
|
31
31
|
const { version } = await inquirer.prompt({
|
|
32
32
|
name: 'version',
|
|
@@ -236,4 +236,23 @@ export async function uninstallVanillaCommand(_libraries) {
|
|
|
236
236
|
}
|
|
237
237
|
console.log(`${count} libraries removed`);
|
|
238
238
|
}
|
|
239
|
-
export async function refreshCommand() {
|
|
239
|
+
export async function refreshCommand() {
|
|
240
|
+
let lockFilePath = path.resolve('./resources/cache/lock-smithed.json');
|
|
241
|
+
let lockFile = false;
|
|
242
|
+
try {
|
|
243
|
+
lockFile = JSON.parse(await fs.readFile(lockFilePath, 'utf-8'));
|
|
244
|
+
}
|
|
245
|
+
catch (e) { }
|
|
246
|
+
if (lockFile) {
|
|
247
|
+
console.log('Refreshing libraries...');
|
|
248
|
+
await fs.remove(path.resolve('./resources/cache/smithed'));
|
|
249
|
+
await fs.writeFile(lockFilePath, '{}');
|
|
250
|
+
await buildCommand({
|
|
251
|
+
path: './src',
|
|
252
|
+
configPath: './'
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
console.log('No libraries to refresh');
|
|
257
|
+
}
|
|
258
|
+
}
|
package/lib/create.d.ts
ADDED
package/lib/create.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Argument, Command } from 'commander';
|
|
3
|
+
import figlet from 'figlet';
|
|
4
|
+
import { createCommand } from './commands/index.js';
|
|
5
|
+
import { BuildDeclares } from './index.js';
|
|
6
|
+
const commander = new Command();
|
|
7
|
+
console.log(figlet.textSync('Sandstone'));
|
|
8
|
+
const createCLI = commander
|
|
9
|
+
.version('1.0.0')
|
|
10
|
+
.description('Create a new Sandstone project. ⛏')
|
|
11
|
+
.action(createCommand)
|
|
12
|
+
.addArgument(new Argument('<projectName>', 'Not the name of the output pack'));
|
|
13
|
+
createCLI.option.apply(createCLI, BuildDeclares.name)
|
|
14
|
+
.option.apply(createCLI, BuildDeclares.namespace)
|
|
15
|
+
.option.apply(createCLI, BuildDeclares.world)
|
|
16
|
+
.option.apply(createCLI, BuildDeclares.clientPath)
|
|
17
|
+
.option.apply(createCLI, BuildDeclares.serverPath);
|
|
18
|
+
createCLI.parse(process.argv);
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export
|
|
2
|
+
export declare const BuildDeclares: Record<string, [string, string, RegExp, boolean]>;
|
package/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ console.log(figlet.textSync('Sandstone'));
|
|
|
7
7
|
const CLI = commander
|
|
8
8
|
.version('1.0.0')
|
|
9
9
|
.description('The CLI for Sandstone - the minecraft pack creation library.');
|
|
10
|
-
const BuildDeclares = {
|
|
10
|
+
export const BuildDeclares = {
|
|
11
11
|
// Flags
|
|
12
12
|
dry: ['-d, --dry', 'Do not save the pack. Mostly useful with `verbose`.'],
|
|
13
13
|
verbose: ['-v, --verbose', 'Log all resulting resources: functions, advancements...'],
|
|
@@ -69,7 +69,6 @@ create.option.apply(create, BuildDeclares.name)
|
|
|
69
69
|
.option.apply(create, BuildDeclares.world)
|
|
70
70
|
.option.apply(create, BuildDeclares.clientPath)
|
|
71
71
|
.option.apply(create, BuildDeclares.serverPath);
|
|
72
|
-
// TODO
|
|
73
72
|
const install = CLI
|
|
74
73
|
.command('install')
|
|
75
74
|
.alias('add')
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sandstone-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "The CLI for Sandstone - the minecraft pack creation library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"sand": "./lib/index.js"
|
|
8
|
+
"sand": "./lib/index.js",
|
|
9
|
+
"create-sandstone": "./lib/create.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"test": "echo NO TESTS",
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
},
|
|
42
43
|
"homepage": "https://github.com/sandstone-mc/sandstone-cli#readme",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@types/node": "^20.10.
|
|
45
|
+
"@types/node": "^20.10.2",
|
|
45
46
|
"chalk": "^5.3.0",
|
|
46
47
|
"chalk-template": "^1.1.0",
|
|
47
48
|
"chokidar": "^3.5.3",
|
package/src/commands/create.ts
CHANGED
|
@@ -45,7 +45,7 @@ export async function createCommand(_project: string, opts: CreateOptions) {
|
|
|
45
45
|
|
|
46
46
|
const sv = (v: string) => new SemVer(v)
|
|
47
47
|
|
|
48
|
-
const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('
|
|
48
|
+
const versions = [[sv('0.13.6'), sv('0.5.4')], [sv('1.0.0-beta.0'), sv('1.1.11')]] as const
|
|
49
49
|
|
|
50
50
|
const stableIndex = 0
|
|
51
51
|
|
|
@@ -298,4 +298,27 @@ export async function uninstallVanillaCommand(_libraries: string[]) {
|
|
|
298
298
|
console.log(`${count} libraries removed`)
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
export async function refreshCommand() {
|
|
301
|
+
export async function refreshCommand() {
|
|
302
|
+
let lockFilePath = path.resolve('./resources/cache/lock-smithed.json')
|
|
303
|
+
|
|
304
|
+
let lockFile: Record<string, {}> | false = false
|
|
305
|
+
|
|
306
|
+
try {
|
|
307
|
+
lockFile = JSON.parse(await fs.readFile(lockFilePath, 'utf-8'))
|
|
308
|
+
} catch (e) {}
|
|
309
|
+
|
|
310
|
+
if (lockFile) {
|
|
311
|
+
console.log('Refreshing libraries...')
|
|
312
|
+
|
|
313
|
+
await fs.remove(path.resolve('./resources/cache/smithed'))
|
|
314
|
+
|
|
315
|
+
await fs.writeFile(lockFilePath, '{}')
|
|
316
|
+
|
|
317
|
+
await buildCommand({
|
|
318
|
+
path: './src',
|
|
319
|
+
configPath: './'
|
|
320
|
+
})
|
|
321
|
+
} else {
|
|
322
|
+
console.log('No libraries to refresh')
|
|
323
|
+
}
|
|
324
|
+
}
|
package/src/create.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Argument, Command } from 'commander';
|
|
3
|
+
import figlet from 'figlet';
|
|
4
|
+
import { createCommand } from './commands/index.js';
|
|
5
|
+
import { BuildDeclares } from './index.js';
|
|
6
|
+
|
|
7
|
+
const commander = new Command()
|
|
8
|
+
|
|
9
|
+
console.log(figlet.textSync('Sandstone'));
|
|
10
|
+
|
|
11
|
+
const createCLI = commander
|
|
12
|
+
.version('1.0.0')
|
|
13
|
+
.description('Create a new Sandstone project. ⛏')
|
|
14
|
+
.action(createCommand)
|
|
15
|
+
.addArgument(new Argument('<projectName>', 'Not the name of the output pack'))
|
|
16
|
+
|
|
17
|
+
createCLI.option.apply(createCLI, BuildDeclares.name)
|
|
18
|
+
.option.apply(createCLI, BuildDeclares.namespace)
|
|
19
|
+
.option.apply(createCLI, BuildDeclares.world)
|
|
20
|
+
.option.apply(createCLI, BuildDeclares.clientPath)
|
|
21
|
+
.option.apply(createCLI, BuildDeclares.serverPath)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
createCLI.parse(process.argv)
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ const CLI = commander
|
|
|
11
11
|
.version('1.0.0')
|
|
12
12
|
.description('The CLI for Sandstone - the minecraft pack creation library.')
|
|
13
13
|
|
|
14
|
-
const BuildDeclares = {
|
|
14
|
+
export const BuildDeclares = {
|
|
15
15
|
// Flags
|
|
16
16
|
dry: ['-d, --dry', 'Do not save the pack. Mostly useful with `verbose`.'],
|
|
17
17
|
verbose: ['-v, --verbose', 'Log all resulting resources: functions, advancements...'],
|
|
@@ -83,7 +83,6 @@ create.option.apply(create, BuildDeclares.name)
|
|
|
83
83
|
.option.apply(create, BuildDeclares.clientPath)
|
|
84
84
|
.option.apply(create, BuildDeclares.serverPath)
|
|
85
85
|
|
|
86
|
-
// TODO
|
|
87
86
|
const install = CLI
|
|
88
87
|
.command('install')
|
|
89
88
|
.alias('add')
|