sandstone-cli 2.3.0 → 2.3.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/bun.lock +2 -2
- package/lib/create.js +2 -2
- package/lib/index.js +24 -4
- package/package.json +2 -2
- package/src/commands/build/index.ts +23 -3
- package/src/commands/create.ts +1 -1
- package/src/version.ts +1 -1
package/bun.lock
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/semver": "^7.5.3",
|
|
32
32
|
"bun-types": "^1.3.9",
|
|
33
33
|
"node-pty": "^1.1.0",
|
|
34
|
-
"sandstone": "^1.0.0-beta.
|
|
34
|
+
"sandstone": "^1.0.0-beta.3",
|
|
35
35
|
"typescript": "^5.2.2",
|
|
36
36
|
},
|
|
37
37
|
},
|
|
@@ -370,7 +370,7 @@
|
|
|
370
370
|
|
|
371
371
|
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
|
372
372
|
|
|
373
|
-
"sandstone": ["sandstone@1.0.0-beta.
|
|
373
|
+
"sandstone": ["sandstone@1.0.0-beta.3", "", { "dependencies": { "@sinclair/typebox": "^0.31.21", "@smithed-mc/data-types": "^0.1.2", "@types/nearley": "^2.11.5", "@types/node": "24", "@typescript/analyze-trace": "^0.4.0", "adm-zip": "^0.5.10", "fs-extra": "^11.1.1", "lodash": "^4.17.21", "nanoid": "^3.3.6", "nearley": "^2.20.1", "node-fetch": "^3.3.2", "prismarine-nbt": "^2.2.1", "semver": "^7.5.4" } }, "sha512-aQNz7uxBQW+B5mQshFiFnTt81ecc77KIih7jDvryM0kdhqtOuF5hwxR7vi3RXvTWkrLVGpnW/D3qClj3ufD0FQ=="],
|
|
374
374
|
|
|
375
375
|
"scheduler": ["scheduler@0.27.0", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
|
|
376
376
|
|
package/lib/create.js
CHANGED
|
@@ -5680,7 +5680,7 @@ var {
|
|
|
5680
5680
|
import figlet from "figlet";
|
|
5681
5681
|
|
|
5682
5682
|
// src/version.ts
|
|
5683
|
-
var CLI_VERSION = "2.3.
|
|
5683
|
+
var CLI_VERSION = "2.3.2";
|
|
5684
5684
|
|
|
5685
5685
|
// src/commands/create.ts
|
|
5686
5686
|
var import_semver = __toESM(require_semver2(), 1);
|
|
@@ -6789,7 +6789,7 @@ async function createCommand2(_project, opts) {
|
|
|
6789
6789
|
default: false
|
|
6790
6790
|
}) === true ? "library" : "pack";
|
|
6791
6791
|
const sv = (v) => new import_semver.SemVer(v);
|
|
6792
|
-
const versions = [[sv("1.0.0-beta.
|
|
6792
|
+
const versions = [[sv("1.0.0-beta.3"), sv(CLI_VERSION)]];
|
|
6793
6793
|
const version = await select({
|
|
6794
6794
|
message: "Which version of Sandstone do you want to use? These are the only supported versions for new projects.",
|
|
6795
6795
|
choices: versions.map((v) => {
|
package/lib/index.js
CHANGED
|
@@ -22574,7 +22574,7 @@ var {
|
|
|
22574
22574
|
import figlet from "figlet";
|
|
22575
22575
|
|
|
22576
22576
|
// src/version.ts
|
|
22577
|
-
var CLI_VERSION = "2.3.
|
|
22577
|
+
var CLI_VERSION = "2.3.2";
|
|
22578
22578
|
|
|
22579
22579
|
// src/commands/build/index.ts
|
|
22580
22580
|
var import_fs_extra4 = __toESM(require_lib(), 1);
|
|
@@ -23816,14 +23816,34 @@ ${e.message || e}`;
|
|
|
23816
23816
|
}
|
|
23817
23817
|
}
|
|
23818
23818
|
if (cliOptions.dry !== true) {
|
|
23819
|
+
const deletedDirs = new Set;
|
|
23819
23820
|
for (const file of Object.keys(oldCache.files)) {
|
|
23820
23821
|
if (!(file in newCache.files)) {
|
|
23821
|
-
|
|
23822
|
+
const fileDir = path5.dirname(file);
|
|
23823
|
+
if (deletedDirs.has(fileDir))
|
|
23824
|
+
continue;
|
|
23825
|
+
let skipFile = false;
|
|
23826
|
+
for (const deletedDir of deletedDirs) {
|
|
23827
|
+
if (fileDir.startsWith(deletedDir + path5.sep)) {
|
|
23828
|
+
skipFile = true;
|
|
23829
|
+
break;
|
|
23830
|
+
}
|
|
23831
|
+
}
|
|
23832
|
+
if (skipFile)
|
|
23833
|
+
continue;
|
|
23834
|
+
try {
|
|
23835
|
+
await import_fs_extra4.default.rm(path5.join(outputFolder, file));
|
|
23836
|
+
} catch (e) {
|
|
23837
|
+
if (e.code !== "ENOENT")
|
|
23838
|
+
throw e;
|
|
23839
|
+
log(source_default.yellow("Warning:"), `Cached file not found during cleanup: ${file}`);
|
|
23840
|
+
}
|
|
23822
23841
|
let dir = undefined;
|
|
23823
|
-
for (const segment of $split(new RegExp(RegExp.escape(path5.sep)),
|
|
23842
|
+
for (const segment of $split(new RegExp(RegExp.escape(path5.sep)), fileDir)) {
|
|
23824
23843
|
dir = dir === undefined ? segment : path5.join(dir, segment);
|
|
23825
23844
|
if (!newDirs.has(dir)) {
|
|
23826
23845
|
await import_fs_extra4.default.rm(path5.join(outputFolder, dir), { force: true, recursive: true });
|
|
23846
|
+
deletedDirs.add(dir);
|
|
23827
23847
|
break;
|
|
23828
23848
|
}
|
|
23829
23849
|
}
|
|
@@ -24476,7 +24496,7 @@ async function createCommand2(_project, opts) {
|
|
|
24476
24496
|
default: false
|
|
24477
24497
|
}) === true ? "library" : "pack";
|
|
24478
24498
|
const sv = (v) => new import_semver.SemVer(v);
|
|
24479
|
-
const versions = [[sv("1.0.0-beta.
|
|
24499
|
+
const versions = [[sv("1.0.0-beta.3"), sv(CLI_VERSION)]];
|
|
24480
24500
|
const version = await select({
|
|
24481
24501
|
message: "Which version of Sandstone do you want to use? These are the only supported versions for new projects.",
|
|
24482
24502
|
choices: versions.map((v) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sandstone-cli",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "The CLI for Sandstone - the minecraft pack creation library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@types/semver": "^7.5.3",
|
|
70
70
|
"bun-types": "^1.3.9",
|
|
71
71
|
"node-pty": "^1.1.0",
|
|
72
|
-
"sandstone": "^1.0.0-beta.
|
|
72
|
+
"sandstone": "^1.0.0-beta.3",
|
|
73
73
|
"typescript": "^5.2.2"
|
|
74
74
|
},
|
|
75
75
|
"trustedDependencies": [
|
|
@@ -320,7 +320,7 @@ async function _buildProject(
|
|
|
320
320
|
dry: cliOptions.dry ?? false,
|
|
321
321
|
verbose: cliOptions.verbose ?? false,
|
|
322
322
|
|
|
323
|
-
// TODO
|
|
323
|
+
// TODO: Implement `contentSummary` and remove this typecast
|
|
324
324
|
fileHandler: (saveOptions.customFileHandler as ((relativePath: string, content: any) => Promise<void>) | undefined) ??
|
|
325
325
|
(async (relativePath: string, content: any) => {
|
|
326
326
|
let pathPass = true
|
|
@@ -426,16 +426,36 @@ async function _buildProject(
|
|
|
426
426
|
|
|
427
427
|
// Clean up old files and directories
|
|
428
428
|
if (cliOptions.dry !== true) {
|
|
429
|
+
const deletedDirs = new Set<string>()
|
|
430
|
+
|
|
429
431
|
for (const file of Object.keys(oldCache.files)) {
|
|
430
432
|
if (!(file in newCache.files)) {
|
|
431
|
-
|
|
433
|
+
// Skip files whose parent directory was already deleted
|
|
434
|
+
const fileDir = path.dirname(file)
|
|
435
|
+
if (deletedDirs.has(fileDir)) continue
|
|
436
|
+
let skipFile = false
|
|
437
|
+
for (const deletedDir of deletedDirs) {
|
|
438
|
+
if (fileDir.startsWith(deletedDir + path.sep)) {
|
|
439
|
+
skipFile = true
|
|
440
|
+
break
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
if (skipFile) continue
|
|
444
|
+
|
|
445
|
+
try {
|
|
446
|
+
await fs.rm(path.join(outputFolder, file))
|
|
447
|
+
} catch (e: any) {
|
|
448
|
+
if (e.code !== 'ENOENT') throw e
|
|
449
|
+
log(chalk.yellow('Warning:'), `Cached file not found during cleanup: ${file}`)
|
|
450
|
+
}
|
|
432
451
|
|
|
433
452
|
let dir: string | undefined = undefined
|
|
434
|
-
for (const segment of split(new RegExp(RegExp.escape(path.sep)),
|
|
453
|
+
for (const segment of split(new RegExp(RegExp.escape(path.sep)), fileDir)) {
|
|
435
454
|
dir = dir === undefined ? segment : path.join(dir, segment)
|
|
436
455
|
|
|
437
456
|
if (!newDirs.has(dir)) {
|
|
438
457
|
await fs.rm(path.join(outputFolder, dir), { force: true, recursive: true })
|
|
458
|
+
deletedDirs.add(dir)
|
|
439
459
|
break
|
|
440
460
|
}
|
|
441
461
|
}
|
package/src/commands/create.ts
CHANGED
|
@@ -130,7 +130,7 @@ export async function createCommand(_project: string, opts: CreateOptions) {
|
|
|
130
130
|
|
|
131
131
|
const sv = (v: string) => new SemVer(v)
|
|
132
132
|
|
|
133
|
-
const versions = [[sv('1.0.0-beta.
|
|
133
|
+
const versions = [[sv('1.0.0-beta.3'), sv(CLI_VERSION)]] as const
|
|
134
134
|
|
|
135
135
|
const version = await select({
|
|
136
136
|
message: 'Which version of Sandstone do you want to use? These are the only supported versions for new projects.',
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '2.3.
|
|
1
|
+
export const CLI_VERSION = '2.3.2'
|