sandstone-cli 2.1.2 → 2.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/lib/index.js CHANGED
@@ -9788,11 +9788,11 @@ var require_react_reconciler_development = __commonJS((exports, module) => {
9788
9788
  fiber = fiber.next, id--;
9789
9789
  return fiber;
9790
9790
  }
9791
- function copyWithSetImpl(obj, path6, index, value) {
9792
- if (index >= path6.length)
9791
+ function copyWithSetImpl(obj, path9, index, value) {
9792
+ if (index >= path9.length)
9793
9793
  return value;
9794
- var key = path6[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
9795
- updated[key] = copyWithSetImpl(obj[key], path6, index + 1, value);
9794
+ var key = path9[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
9795
+ updated[key] = copyWithSetImpl(obj[key], path9, index + 1, value);
9796
9796
  return updated;
9797
9797
  }
9798
9798
  function copyWithRename(obj, oldPath, newPath) {
@@ -9812,11 +9812,11 @@ var require_react_reconciler_development = __commonJS((exports, module) => {
9812
9812
  index + 1 === oldPath.length ? (updated[newPath[index]] = updated[oldKey], isArrayImpl(updated) ? updated.splice(oldKey, 1) : delete updated[oldKey]) : updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1);
9813
9813
  return updated;
9814
9814
  }
9815
- function copyWithDeleteImpl(obj, path6, index) {
9816
- var key = path6[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
9817
- if (index + 1 === path6.length)
9815
+ function copyWithDeleteImpl(obj, path9, index) {
9816
+ var key = path9[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
9817
+ if (index + 1 === path9.length)
9818
9818
  return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
9819
- updated[key] = copyWithDeleteImpl(obj[key], path6, index + 1);
9819
+ updated[key] = copyWithDeleteImpl(obj[key], path9, index + 1);
9820
9820
  return updated;
9821
9821
  }
9822
9822
  function shouldSuspendImpl() {
@@ -19839,29 +19839,29 @@ Check the top-level render call using <` + componentName2 + ">.");
19839
19839
  var didWarnAboutNestedUpdates = false;
19840
19840
  var didWarnAboutFindNodeInStrictMode = {};
19841
19841
  var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, scheduleRetry = null, setErrorHandler = null, setSuspenseHandler = null;
19842
- overrideHookState = function(fiber, id, path6, value) {
19842
+ overrideHookState = function(fiber, id, path9, value) {
19843
19843
  id = findHook(fiber, id);
19844
- id !== null && (path6 = copyWithSetImpl(id.memoizedState, path6, 0, value), id.memoizedState = path6, id.baseState = path6, fiber.memoizedProps = assign({}, fiber.memoizedProps), path6 = enqueueConcurrentRenderForLane(fiber, 2), path6 !== null && scheduleUpdateOnFiber(path6, fiber, 2));
19844
+ id !== null && (path9 = copyWithSetImpl(id.memoizedState, path9, 0, value), id.memoizedState = path9, id.baseState = path9, fiber.memoizedProps = assign({}, fiber.memoizedProps), path9 = enqueueConcurrentRenderForLane(fiber, 2), path9 !== null && scheduleUpdateOnFiber(path9, fiber, 2));
19845
19845
  };
19846
- overrideHookStateDeletePath = function(fiber, id, path6) {
19846
+ overrideHookStateDeletePath = function(fiber, id, path9) {
19847
19847
  id = findHook(fiber, id);
19848
- id !== null && (path6 = copyWithDeleteImpl(id.memoizedState, path6, 0), id.memoizedState = path6, id.baseState = path6, fiber.memoizedProps = assign({}, fiber.memoizedProps), path6 = enqueueConcurrentRenderForLane(fiber, 2), path6 !== null && scheduleUpdateOnFiber(path6, fiber, 2));
19848
+ id !== null && (path9 = copyWithDeleteImpl(id.memoizedState, path9, 0), id.memoizedState = path9, id.baseState = path9, fiber.memoizedProps = assign({}, fiber.memoizedProps), path9 = enqueueConcurrentRenderForLane(fiber, 2), path9 !== null && scheduleUpdateOnFiber(path9, fiber, 2));
19849
19849
  };
19850
19850
  overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
19851
19851
  id = findHook(fiber, id);
19852
19852
  id !== null && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), oldPath !== null && scheduleUpdateOnFiber(oldPath, fiber, 2));
19853
19853
  };
19854
- overrideProps = function(fiber, path6, value) {
19855
- fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path6, 0, value);
19854
+ overrideProps = function(fiber, path9, value) {
19855
+ fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path9, 0, value);
19856
19856
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
19857
- path6 = enqueueConcurrentRenderForLane(fiber, 2);
19858
- path6 !== null && scheduleUpdateOnFiber(path6, fiber, 2);
19857
+ path9 = enqueueConcurrentRenderForLane(fiber, 2);
19858
+ path9 !== null && scheduleUpdateOnFiber(path9, fiber, 2);
19859
19859
  };
19860
- overridePropsDeletePath = function(fiber, path6) {
19861
- fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path6, 0);
19860
+ overridePropsDeletePath = function(fiber, path9) {
19861
+ fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path9, 0);
19862
19862
  fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
19863
- path6 = enqueueConcurrentRenderForLane(fiber, 2);
19864
- path6 !== null && scheduleUpdateOnFiber(path6, fiber, 2);
19863
+ path9 = enqueueConcurrentRenderForLane(fiber, 2);
19864
+ path9 !== null && scheduleUpdateOnFiber(path9, fiber, 2);
19865
19865
  };
19866
19866
  overridePropsRenamePath = function(fiber, oldPath, newPath) {
19867
19867
  fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
@@ -22574,7 +22574,7 @@ var {
22574
22574
  import figlet from "figlet";
22575
22575
 
22576
22576
  // src/version.ts
22577
- var CLI_VERSION = "2.1.2";
22577
+ var CLI_VERSION = "2.2.0";
22578
22578
 
22579
22579
  // src/commands/build.ts
22580
22580
  var import_fs_extra2 = __toESM(require_lib(), 1);
@@ -23903,7 +23903,7 @@ async function buildCommand(opts, _folder, silent2 = false) {
23903
23903
  // src/commands/create.ts
23904
23904
  var import_semver = __toESM(require_semver2(), 1);
23905
23905
  var import_fs_extra3 = __toESM(require_lib(), 1);
23906
- import path4 from "path";
23906
+ import path7 from "path";
23907
23907
 
23908
23908
  // node_modules/chalk-template/index.js
23909
23909
  var TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.))|(?:{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(})|((?:.|[\r\n\f])+?)/gi;
@@ -24084,6 +24084,300 @@ var nanoid = (size = 21) => {
24084
24084
 
24085
24085
  // src/commands/create.ts
24086
24086
  import { confirm, select, input } from "@inquirer/prompts";
24087
+
24088
+ // src/launchers/registry.ts
24089
+ var providers = new Map;
24090
+ function registerProvider(provider) {
24091
+ providers.set(provider.type, provider);
24092
+ }
24093
+ function getProviders() {
24094
+ return Array.from(providers.values());
24095
+ }
24096
+ async function discoverAllInstances() {
24097
+ const result = {
24098
+ instances: [],
24099
+ errors: new Map
24100
+ };
24101
+ const discoveries = await Promise.allSettled(getProviders().map(async (provider) => {
24102
+ const instances = await provider.discoverInstances();
24103
+ return { type: provider.type, instances };
24104
+ }));
24105
+ for (const discovery of discoveries) {
24106
+ if (discovery.status === "fulfilled") {
24107
+ result.instances.push(...discovery.value.instances);
24108
+ } else {
24109
+ const error = discovery.reason;
24110
+ console.error("Discovery error:", error.message);
24111
+ }
24112
+ }
24113
+ return result;
24114
+ }
24115
+ // src/launchers/providers/vanilla.ts
24116
+ import fs4 from "fs";
24117
+ import path4 from "path";
24118
+ import os4 from "os";
24119
+ function getVanillaPath() {
24120
+ let mcPath;
24121
+ switch (os4.platform()) {
24122
+ case "win32":
24123
+ mcPath = path4.join(os4.homedir(), "AppData/Roaming/.minecraft");
24124
+ break;
24125
+ case "darwin":
24126
+ mcPath = path4.join(os4.homedir(), "Library/Application Support/minecraft");
24127
+ break;
24128
+ case "linux":
24129
+ default:
24130
+ mcPath = path4.join(os4.homedir(), ".minecraft");
24131
+ break;
24132
+ }
24133
+ return fs4.existsSync(mcPath) ? mcPath : null;
24134
+ }
24135
+ var vanillaProvider = {
24136
+ type: "vanilla",
24137
+ displayName: "Vanilla Minecraft",
24138
+ async isInstalled() {
24139
+ return getVanillaPath() !== null;
24140
+ },
24141
+ getDataPath() {
24142
+ return getVanillaPath();
24143
+ },
24144
+ async discoverInstances() {
24145
+ const dataPath = getVanillaPath();
24146
+ if (!dataPath)
24147
+ return [];
24148
+ return [{
24149
+ id: "vanilla",
24150
+ name: "Vanilla Minecraft",
24151
+ launcher: "vanilla",
24152
+ minecraftPath: dataPath
24153
+ }];
24154
+ }
24155
+ };
24156
+
24157
+ // src/launchers/providers/prism.ts
24158
+ import fs5 from "fs";
24159
+ import path5 from "path";
24160
+ import os5 from "os";
24161
+ function getPrismCandidatePaths() {
24162
+ const home = os5.homedir();
24163
+ const paths = [];
24164
+ switch (os5.platform()) {
24165
+ case "win32":
24166
+ paths.push(path5.join(os5.homedir(), "AppData/Roaming/PrismLauncher"));
24167
+ break;
24168
+ case "darwin":
24169
+ paths.push(path5.join(home, "Library/Application Support/PrismLauncher"));
24170
+ break;
24171
+ case "linux":
24172
+ default: {
24173
+ const xdgDataHome = process.env.XDG_DATA_HOME;
24174
+ if (xdgDataHome) {
24175
+ paths.push(path5.join(xdgDataHome, "PrismLauncher"));
24176
+ }
24177
+ paths.push(path5.join(home, ".local/share/PrismLauncher"));
24178
+ paths.push(path5.join(home, ".var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher"));
24179
+ break;
24180
+ }
24181
+ }
24182
+ return paths;
24183
+ }
24184
+ function getPrismDataPath() {
24185
+ for (const candidate of getPrismCandidatePaths()) {
24186
+ if (fs5.existsSync(candidate)) {
24187
+ return candidate;
24188
+ }
24189
+ }
24190
+ return null;
24191
+ }
24192
+ function parseInstanceConfig(configPath) {
24193
+ try {
24194
+ const content = fs5.readFileSync(configPath, "utf-8");
24195
+ const result = {};
24196
+ for (const line of content.split(`
24197
+ `)) {
24198
+ const trimmed = line.trim();
24199
+ if (trimmed.startsWith("name=")) {
24200
+ result.name = trimmed.slice(5);
24201
+ break;
24202
+ }
24203
+ }
24204
+ return result;
24205
+ } catch {
24206
+ return {};
24207
+ }
24208
+ }
24209
+ function parsePackJson(packPath) {
24210
+ try {
24211
+ const content = fs5.readFileSync(packPath, "utf-8");
24212
+ const pack = JSON.parse(content);
24213
+ const components = pack.components;
24214
+ if (components) {
24215
+ const minecraft = components.find((c) => c.uid === "net.minecraft");
24216
+ if (minecraft?.version) {
24217
+ return { version: minecraft.version };
24218
+ }
24219
+ }
24220
+ return {};
24221
+ } catch {
24222
+ return {};
24223
+ }
24224
+ }
24225
+ var prismProvider = {
24226
+ type: "prism",
24227
+ displayName: "Prism Launcher",
24228
+ async isInstalled() {
24229
+ return getPrismDataPath() !== null;
24230
+ },
24231
+ getDataPath() {
24232
+ return getPrismDataPath();
24233
+ },
24234
+ async discoverInstances() {
24235
+ const dataPath = getPrismDataPath();
24236
+ if (!dataPath)
24237
+ return [];
24238
+ const instancesDir = path5.join(dataPath, "instances");
24239
+ if (!fs5.existsSync(instancesDir))
24240
+ return [];
24241
+ const instances = [];
24242
+ try {
24243
+ const entries = fs5.readdirSync(instancesDir, { withFileTypes: true });
24244
+ for (const entry of entries) {
24245
+ if (!entry.isDirectory())
24246
+ continue;
24247
+ if (entry.name.startsWith(".") || entry.name.startsWith("_"))
24248
+ continue;
24249
+ const instanceDir = path5.join(instancesDir, entry.name);
24250
+ const minecraftDir = path5.join(instanceDir, "minecraft");
24251
+ const dotMinecraftDir = path5.join(instanceDir, ".minecraft");
24252
+ let minecraftPath = null;
24253
+ if (fs5.existsSync(minecraftDir)) {
24254
+ minecraftPath = minecraftDir;
24255
+ } else if (fs5.existsSync(dotMinecraftDir)) {
24256
+ minecraftPath = dotMinecraftDir;
24257
+ }
24258
+ if (!minecraftPath)
24259
+ continue;
24260
+ const configPath = path5.join(instanceDir, "instance.cfg");
24261
+ const config = parseInstanceConfig(configPath);
24262
+ const packPath = path5.join(instanceDir, "mmc-pack.json");
24263
+ const pack = parsePackJson(packPath);
24264
+ instances.push({
24265
+ id: `prism-${entry.name}`,
24266
+ name: config.name || entry.name,
24267
+ launcher: "prism",
24268
+ minecraftPath,
24269
+ version: pack.version
24270
+ });
24271
+ }
24272
+ } catch {}
24273
+ return instances;
24274
+ }
24275
+ };
24276
+
24277
+ // src/launchers/providers/modrinth.ts
24278
+ import fs6 from "fs";
24279
+ import path6 from "path";
24280
+ import os6 from "os";
24281
+ import { Database } from "bun:sqlite";
24282
+ function getModrinthCandidatePaths() {
24283
+ const home = os6.homedir();
24284
+ const paths = [];
24285
+ switch (os6.platform()) {
24286
+ case "win32":
24287
+ paths.push(path6.join(os6.homedir(), "AppData/Roaming/ModrinthApp"));
24288
+ break;
24289
+ case "darwin":
24290
+ paths.push(path6.join(home, "Library/Application Support/ModrinthApp"));
24291
+ break;
24292
+ case "linux":
24293
+ default: {
24294
+ const xdgDataHome = process.env.XDG_DATA_HOME;
24295
+ if (xdgDataHome) {
24296
+ paths.push(path6.join(xdgDataHome, "ModrinthApp"));
24297
+ }
24298
+ paths.push(path6.join(home, ".local/share/ModrinthApp"));
24299
+ paths.push(path6.join(home, ".var/app/com.modrinth.ModrinthApp/data/ModrinthApp"));
24300
+ break;
24301
+ }
24302
+ }
24303
+ return paths;
24304
+ }
24305
+ function getModrinthDataPath() {
24306
+ for (const candidate of getModrinthCandidatePaths()) {
24307
+ if (fs6.existsSync(candidate)) {
24308
+ return candidate;
24309
+ }
24310
+ }
24311
+ return null;
24312
+ }
24313
+ function getProfilesFromDb(dataPath) {
24314
+ const profiles = new Map;
24315
+ const dbPath = path6.join(dataPath, "app.db");
24316
+ if (!fs6.existsSync(dbPath))
24317
+ return profiles;
24318
+ try {
24319
+ const db = new Database(dbPath, { readonly: true });
24320
+ const rows = db.query("SELECT path, name, game_version FROM profiles").all();
24321
+ for (const row of rows) {
24322
+ profiles.set(row.path, {
24323
+ name: row.name,
24324
+ version: row.game_version ?? undefined
24325
+ });
24326
+ }
24327
+ db.close();
24328
+ } catch {}
24329
+ return profiles;
24330
+ }
24331
+ var modrinthProvider = {
24332
+ type: "modrinth",
24333
+ displayName: "Modrinth App",
24334
+ async isInstalled() {
24335
+ return getModrinthDataPath() !== null;
24336
+ },
24337
+ getDataPath() {
24338
+ return getModrinthDataPath();
24339
+ },
24340
+ async discoverInstances() {
24341
+ const dataPath = getModrinthDataPath();
24342
+ if (!dataPath)
24343
+ return [];
24344
+ const profilesDir = path6.join(dataPath, "profiles");
24345
+ if (!fs6.existsSync(profilesDir))
24346
+ return [];
24347
+ const profileMetadata = getProfilesFromDb(dataPath);
24348
+ const instances = [];
24349
+ try {
24350
+ const entries = fs6.readdirSync(profilesDir, { withFileTypes: true });
24351
+ for (const entry of entries) {
24352
+ if (!entry.isDirectory())
24353
+ continue;
24354
+ if (entry.name.startsWith("."))
24355
+ continue;
24356
+ const minecraftPath = path6.join(profilesDir, entry.name);
24357
+ const hasSaves = fs6.existsSync(path6.join(minecraftPath, "saves"));
24358
+ const hasMods = fs6.existsSync(path6.join(minecraftPath, "mods"));
24359
+ if (!hasSaves && !hasMods)
24360
+ continue;
24361
+ const metadata = profileMetadata.get(entry.name);
24362
+ instances.push({
24363
+ id: `modrinth-${entry.name}`,
24364
+ name: metadata?.name || entry.name,
24365
+ launcher: "modrinth",
24366
+ minecraftPath,
24367
+ version: metadata?.version
24368
+ });
24369
+ }
24370
+ } catch {}
24371
+ return instances;
24372
+ }
24373
+ };
24374
+
24375
+ // src/launchers/index.ts
24376
+ registerProvider(vanillaProvider);
24377
+ registerProvider(prismProvider);
24378
+ registerProvider(modrinthProvider);
24379
+
24380
+ // src/commands/create.ts
24087
24381
  function toJson(obj, pretty = false) {
24088
24382
  return util.inspect(obj, {
24089
24383
  depth: Number(Infinity),
@@ -24093,9 +24387,78 @@ function toJson(obj, pretty = false) {
24093
24387
  maxArrayLength: Number(Infinity)
24094
24388
  });
24095
24389
  }
24390
+ function parseVersion(version) {
24391
+ if (!version)
24392
+ return null;
24393
+ const match = version.match(/^(\d+)\.(\d+)(?:\.(\d+))?/);
24394
+ if (match) {
24395
+ return [parseInt(match[1]), parseInt(match[2]), parseInt(match[3] || "0")];
24396
+ }
24397
+ const snapshotMatch = version.match(/^(\d+)w(\d+)/);
24398
+ if (snapshotMatch) {
24399
+ return [1, parseInt(snapshotMatch[1]), parseInt(snapshotMatch[2])];
24400
+ }
24401
+ return null;
24402
+ }
24403
+ function compareVersions(a, b) {
24404
+ if (!a && !b)
24405
+ return 0;
24406
+ if (!a)
24407
+ return 1;
24408
+ if (!b)
24409
+ return -1;
24410
+ for (let i = 0;i < 3; i++) {
24411
+ if (a[i] !== b[i])
24412
+ return b[i] - a[i];
24413
+ }
24414
+ return 0;
24415
+ }
24416
+ async function selectClientInstance() {
24417
+ const { instances } = await discoverAllInstances();
24418
+ if (instances.length === 0) {
24419
+ return await input({ message: "No Minecraft installations detected. Enter path to .minecraft folder:" });
24420
+ }
24421
+ const vanilla = instances.find((i) => i.launcher === "vanilla");
24422
+ const otherInstances = instances.filter((i) => i.launcher !== "vanilla");
24423
+ otherInstances.sort((a, b) => {
24424
+ const versionCmp = compareVersions(parseVersion(a.version), parseVersion(b.version));
24425
+ if (versionCmp !== 0)
24426
+ return versionCmp;
24427
+ return a.name.localeCompare(b.name);
24428
+ });
24429
+ const choices = [];
24430
+ choices.push({ name: "Custom path...", value: "custom", short: "Custom" });
24431
+ choices.push({ name: "None (configure later)", value: "none", short: "None" });
24432
+ if (vanilla) {
24433
+ choices.push({
24434
+ name: `${vanilla.name} [${vanilla.launcher}]`,
24435
+ value: vanilla,
24436
+ short: vanilla.name
24437
+ });
24438
+ }
24439
+ for (const i of otherInstances) {
24440
+ choices.push({
24441
+ name: `${i.name}${i.version ? ` (${i.version})` : ""} [${i.launcher}]`,
24442
+ value: i,
24443
+ short: i.name
24444
+ });
24445
+ }
24446
+ const selected = await select({
24447
+ message: "Select Minecraft installation:",
24448
+ choices,
24449
+ default: vanilla ?? "none"
24450
+ });
24451
+ if (selected === "none") {
24452
+ return;
24453
+ }
24454
+ if (selected === "custom") {
24455
+ return await input({ message: "Enter path to .minecraft folder:" });
24456
+ }
24457
+ return selected.minecraftPath;
24458
+ }
24096
24459
  async function createCommand2(_project, opts) {
24097
- const projectPath = path4.resolve(_project);
24098
- const projectName = path4.basename(projectPath);
24460
+ const projectPath = path7.resolve(_project);
24461
+ const projectName = path7.basename(projectPath);
24099
24462
  const projectType = await confirm({
24100
24463
  message: "Whether your project will be a library for use in other Sandstone projects >",
24101
24464
  default: false
@@ -24163,22 +24526,33 @@ async function createCommand2(_project, opts) {
24163
24526
  }]
24164
24527
  });
24165
24528
  switch (saveChoice) {
24166
- case "root":
24529
+ case "root": {
24530
+ const clientPath = await selectClientInstance();
24531
+ if (clientPath) {
24532
+ saveOptions.clientPath = clientPath;
24533
+ }
24167
24534
  saveOptions.root = true;
24168
24535
  break;
24169
- case "world":
24536
+ }
24537
+ case "world": {
24538
+ const clientPath = await selectClientInstance();
24539
+ if (clientPath) {
24540
+ saveOptions.clientPath = clientPath;
24541
+ }
24170
24542
  const world = await select({
24171
24543
  message: "What world do you want to save the packs in? >",
24172
24544
  choices: getWorldsList(saveOptions.clientPath)
24173
24545
  });
24174
24546
  saveOptions.world = world;
24175
24547
  break;
24176
- case "server-path":
24548
+ }
24549
+ case "server-path": {
24177
24550
  const serverPath = await input({
24178
24551
  message: "Where is the server to save the packs in? Relative paths are accepted. >"
24179
24552
  });
24180
24553
  saveOptions.serverPath = serverPath;
24181
24554
  break;
24555
+ }
24182
24556
  case "none":
24183
24557
  break;
24184
24558
  }
@@ -24206,9 +24580,9 @@ async function createCommand2(_project, opts) {
24206
24580
  const exec = (cmd) => child.execSync(cmd, { cwd: projectPath });
24207
24581
  exec("git clone https://github.com/sandstone-mc/sandstone-template.git .");
24208
24582
  exec(`git checkout ${projectType}-${version[0]}`);
24209
- await import_fs_extra3.default.rm(".git", { force: true, recursive: true });
24583
+ await import_fs_extra3.default.rm(path7.join(projectPath, ".git"), { force: true, recursive: true });
24210
24584
  exec(`${packageManager} install`);
24211
- const configPath = path4.join(projectPath, `${projectType === "library" ? "test/" : ""}sandstone.config.ts`);
24585
+ const configPath = path7.join(projectPath, `${projectType === "library" ? "test/" : ""}sandstone.config.ts`);
24212
24586
  let templateConfig = await import_fs_extra3.default.readFile(configPath, "utf8");
24213
24587
  templateConfig = templateConfig.replace("packUid: 'kZZpDK67'", `packUid: ${toJson(nanoid(8))}`);
24214
24588
  templateConfig = templateConfig.replace("name: 'template'", `name: ${toJson(packName)}`);
@@ -24230,7 +24604,7 @@ async function createCommand2(_project, opts) {
24230
24604
  }
24231
24605
  // src/commands/dependency.ts
24232
24606
  var import_fs_extra4 = __toESM(require_lib(), 1);
24233
- import path5 from "path";
24607
+ import path8 from "path";
24234
24608
  import { exec } from "child_process";
24235
24609
  import { checkbox } from "@inquirer/prompts";
24236
24610
  var _fetch = import("node-fetch");
@@ -24276,9 +24650,9 @@ async function installNativeCommand(_libraries) {
24276
24650
  }
24277
24651
  if (adding) {
24278
24652
  console.log(`Installing ${adding.join(", ")}...`);
24279
- const pnpm = await import_fs_extra4.default.exists(path5.resolve("./pnpm-lock.yaml"));
24280
- const yarn = await import_fs_extra4.default.exists(path5.resolve("./yarn.lock"));
24281
- const npm = await import_fs_extra4.default.exists(path5.resolve("./package-lock.json"));
24653
+ const pnpm = await import_fs_extra4.default.exists(path8.resolve("./pnpm-lock.yaml"));
24654
+ const yarn = await import_fs_extra4.default.exists(path8.resolve("./yarn.lock"));
24655
+ const npm = await import_fs_extra4.default.exists(path8.resolve("./package-lock.json"));
24282
24656
  if (pnpm) {
24283
24657
  exec(`pnpm i ${adding.join(" ")}`);
24284
24658
  } else if (yarn) {
@@ -24296,7 +24670,7 @@ async function installVanillaCommand(_libraries) {
24296
24670
  let count = libraries.length || 0;
24297
24671
  let manifest = false;
24298
24672
  try {
24299
- manifest = JSON.parse(await import_fs_extra4.default.readFile(path5.resolve("./resources/smithed.json"), "utf-8"));
24673
+ manifest = JSON.parse(await import_fs_extra4.default.readFile(path8.resolve("./resources/smithed.json"), "utf-8"));
24300
24674
  } catch (e) {}
24301
24675
  const fetch2 = (await _fetch).default;
24302
24676
  const base = "https://api.smithed.dev/v2";
@@ -24393,9 +24767,9 @@ async function installVanillaCommand(_libraries) {
24393
24767
  async function uninstallVanillaCommand(_libraries) {
24394
24768
  const libraries = _libraries || [];
24395
24769
  let count = libraries.length || 0;
24396
- let manifestPath = path5.resolve("./resources/smithed.json");
24770
+ let manifestPath = path8.resolve("./resources/smithed.json");
24397
24771
  let manifest = false;
24398
- let lockFilePath = path5.resolve("./resources/cache/lock-smithed.json");
24772
+ let lockFilePath = path8.resolve("./resources/cache/lock-smithed.json");
24399
24773
  let lockFile = false;
24400
24774
  try {
24401
24775
  manifest = JSON.parse(await import_fs_extra4.default.readFile(manifestPath, "utf-8"));
@@ -24419,7 +24793,7 @@ async function uninstallVanillaCommand(_libraries) {
24419
24793
  for await (const library of libraries) {
24420
24794
  if (manifest[library]) {
24421
24795
  delete manifest[library];
24422
- await import_fs_extra4.default.remove(path5.resolve(`./resources/cache/smithed/${library}`));
24796
+ await import_fs_extra4.default.remove(path8.resolve(`./resources/cache/smithed/${library}`));
24423
24797
  if (lockFile) {
24424
24798
  delete lockFile[library];
24425
24799
  }
@@ -24442,14 +24816,14 @@ async function uninstallVanillaCommand(_libraries) {
24442
24816
  console.log(`${count} libraries removed`);
24443
24817
  }
24444
24818
  async function refreshCommand() {
24445
- let lockFilePath = path5.resolve("./resources/cache/lock-smithed.json");
24819
+ let lockFilePath = path8.resolve("./resources/cache/lock-smithed.json");
24446
24820
  let lockFile = false;
24447
24821
  try {
24448
24822
  lockFile = JSON.parse(await import_fs_extra4.default.readFile(lockFilePath, "utf-8"));
24449
24823
  } catch (e) {}
24450
24824
  if (lockFile) {
24451
24825
  console.log("Refreshing libraries...");
24452
- await import_fs_extra4.default.remove(path5.resolve("./resources/cache/smithed"));
24826
+ await import_fs_extra4.default.remove(path8.resolve("./resources/cache/smithed"));
24453
24827
  await import_fs_extra4.default.writeFile(lockFilePath, "{}");
24454
24828
  await buildCommand({
24455
24829
  path: "./"
@@ -24625,7 +24999,7 @@ __export(exports_base, {
24625
24999
  ConEmu: () => ConEmu
24626
25000
  });
24627
25001
  import process3 from "process";
24628
- import os4 from "os";
25002
+ import os7 from "os";
24629
25003
 
24630
25004
  // node_modules/environment/index.js
24631
25005
  var isBrowser = globalThis.window?.document !== undefined;
@@ -24724,7 +25098,7 @@ var isOldWindows = () => {
24724
25098
  if (isBrowser || !isWindows2) {
24725
25099
  return false;
24726
25100
  }
24727
- const parts = os4.release().split(".");
25101
+ const parts = os7.release().split(".");
24728
25102
  const major = Number(parts[0]);
24729
25103
  const build = Number(parts[2] ?? 0);
24730
25104
  if (major < 10) {
@@ -28886,7 +29260,7 @@ var FocusContext_default = FocusContext;
28886
29260
  // node_modules/ink/build/components/ErrorOverview.js
28887
29261
  var import_react11 = __toESM(require_react(), 1);
28888
29262
  var import_stack_utils = __toESM(require_stack_utils(), 1);
28889
- import * as fs6 from "fs";
29263
+ import * as fs9 from "fs";
28890
29264
  import { cwd } from "process";
28891
29265
 
28892
29266
  // node_modules/convert-to-spaces/dist/index.js
@@ -29006,8 +29380,8 @@ function Text({ color, backgroundColor, dimColor = false, bold = false, italic =
29006
29380
  }
29007
29381
 
29008
29382
  // node_modules/ink/build/components/ErrorOverview.js
29009
- var cleanupPath = (path6) => {
29010
- return path6?.replace(`file://${cwd()}/`, "");
29383
+ var cleanupPath = (path9) => {
29384
+ return path9?.replace(`file://${cwd()}/`, "");
29011
29385
  };
29012
29386
  var stackUtils = new import_stack_utils.default({
29013
29387
  cwd: cwd(),
@@ -29020,8 +29394,8 @@ function ErrorOverview({ error }) {
29020
29394
  const filePath = cleanupPath(origin?.file);
29021
29395
  let excerpt;
29022
29396
  let lineWidth = 0;
29023
- if (filePath && origin?.line && fs6.existsSync(filePath)) {
29024
- const sourceCode = fs6.readFileSync(filePath, "utf8");
29397
+ if (filePath && origin?.line && fs9.existsSync(filePath)) {
29398
+ const sourceCode = fs9.readFileSync(filePath, "utf8");
29025
29399
  excerpt = dist_default3(sourceCode, origin.line);
29026
29400
  if (excerpt) {
29027
29401
  for (const { line } of excerpt) {
@@ -30175,7 +30549,7 @@ class Hot {
30175
30549
  #disposeCallbacks = new Map;
30176
30550
  #processMessageHandler;
30177
30551
  #hasOneDeclinedPath(paths) {
30178
- return paths.some((path6) => this.#declinePaths.has(path6));
30552
+ return paths.some((path9) => this.#declinePaths.has(path9));
30179
30553
  }
30180
30554
  #onMessage(message) {
30181
30555
  if (message.type === "hot-hook:full-reload") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandstone-cli",
3
- "version": "2.1.2",
3
+ "version": "2.2.0",
4
4
  "description": "The CLI for Sandstone - the minecraft pack creation library.",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -10,7 +10,8 @@
10
10
  },
11
11
  "scripts": {
12
12
  "bundle": "bun scripts/version.ts && bun build src/index.ts --outfile=lib/index.js --target=bun --external=@parcel/watcher --external=figlet --external=@inquirer/prompts && bun build src/create.ts --outfile=lib/create.js --target=bun --external=@parcel/watcher --external=figlet --external=@inquirer/prompts",
13
- "dev:build": "tsc && bun bundle"
13
+ "dev:build": "tsc && bun bundle",
14
+ "test:harness": "npx tsx scripts/test-harness.ts"
14
15
  },
15
16
  "repository": {
16
17
  "type": "git",
@@ -44,7 +45,7 @@
44
45
  "dependencies": {
45
46
  "@inquirer/prompts": "^8.2.0",
46
47
  "@parcel/watcher": "^2.5.6",
47
- "@sandstone-mc/hot-hook": "^0.1.0",
48
+ "@sandstone-mc/hot-hook": "link:@sandstone-mc/hot-hook",
48
49
  "@types/chalk": "^2.2.4",
49
50
  "adm-zip": "^0.5.10",
50
51
  "chalk": "^5.6.2",
@@ -66,7 +67,9 @@
66
67
  "@types/fs-extra": "^11.0.2",
67
68
  "@types/react": "^19.2.10",
68
69
  "@types/semver": "^7.5.3",
69
- "sandstone": "^1.0.0-beta.1",
70
+ "bun-types": "^1.3.9",
71
+ "node-pty": "^1.1.0",
72
+ "sandstone": "link:sandstone",
70
73
  "typescript": "^5.2.2"
71
74
  }
72
75
  }