sandstone-cli 2.1.0 → 2.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sandstone-cli",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "The CLI for Sandstone - the minecraft pack creation library.",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -9,7 +9,7 @@
9
9
  "create-sandstone": "./lib/create.js"
10
10
  },
11
11
  "scripts": {
12
- "build": "bun scripts/version.ts && bun build src/index.ts --outfile=lib/index.js --target=node --external=@parcel/watcher --external=figlet && bun build src/create.ts --outfile=lib/create.js --target=node --external=@parcel/watcher --external=figlet",
12
+ "build": "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
13
  "dev:build": "tsc && bun run build"
14
14
  },
15
15
  "repository": {
@@ -65,7 +65,6 @@ export type BuildOptions = {
65
65
  dry?: boolean
66
66
  verbose?: boolean
67
67
  root?: boolean
68
- fullTrace?: boolean
69
68
  strictErrors?: boolean
70
69
  production?: boolean
71
70
 
@@ -385,11 +384,12 @@ async function _buildProject(
385
384
  }
386
385
  }
387
386
  } catch (e: any) {
388
- const errorMsg = `While loading "${entrypointPath}":\n${cliOptions.fullTrace ? e : (e.message || e)}`
389
- if (!silent) {
387
+ const errorMsg = `While loading "${entrypointPath}":\n${e.stack || e.message || e}`
388
+ if (silent) {
389
+ log('BuildError:', errorMsg)
390
+ } else {
390
391
  console.error(chalk.bgRed.white('BuildError') + chalk.gray(':'), errorMsg)
391
392
  }
392
- log('BuildError:', errorMsg)
393
393
  throw e // Re-throw for buildCommand to handle
394
394
  }
395
395
 
@@ -839,19 +839,15 @@ export async function buildCommand(opts: BuildOptions, _folder?: string, silent
839
839
  } catch (err: any) {
840
840
  const errorMessage = err.message || String(err)
841
841
  if (!silent) {
842
- console.error(chalk.red('Build failed:'), errorMessage)
843
- if (opts.fullTrace) {
844
- console.error(err)
845
- }
842
+ // Error already logged by _buildProject with highlighting
843
+ process.exit(1)
846
844
  }
847
845
  log('Build failed:', errorMessage)
848
- if (silent) {
849
- return {
850
- success: false,
851
- error: opts.fullTrace ? String(err) : errorMessage,
852
- resourceCounts: { functions: 0, other: 0 },
853
- timestamp: Date.now(),
854
- }
846
+ return {
847
+ success: false,
848
+ error: err.stack || errorMessage,
849
+ resourceCounts: { functions: 0, other: 0 },
850
+ timestamp: Date.now(),
855
851
  }
856
852
  }
857
853
  }
@@ -56,7 +56,7 @@ export async function watchCommand(opts: WatchOptions) {
56
56
  // Since this isn't SIGINT, its fine that we don't await this
57
57
  exit: () => exit(subscription, unmountInk)
58
58
  }),
59
- { patchConsole: false }
59
+ { patchConsole: false, exitOnCtrlC: false }
60
60
  )
61
61
  unmountInk = unmount
62
62
 
package/src/index.ts CHANGED
@@ -20,7 +20,6 @@ CLI
20
20
  .addOption(BuildOptions.get('dry'))
21
21
  .addOption(BuildOptions.get('verbose'))
22
22
  .addOption(BuildOptions.get('root'))
23
- .addOption(BuildOptions.get('fullTrace'))
24
23
  .addOption(BuildOptions.get('strictErrors'))
25
24
  .addOption(BuildOptions.get('production'))
26
25
  .addOption(BuildOptions.get('path'))
@@ -37,7 +36,6 @@ CLI
37
36
  .addOption(BuildOptions.get('dry'))
38
37
  .addOption(BuildOptions.get('verbose'))
39
38
  .addOption(BuildOptions.get('root'))
40
- .addOption(BuildOptions.get('fullTrace'))
41
39
  .addOption(BuildOptions.get('strictErrors'))
42
40
  .addOption(BuildOptions.get('path'))
43
41
  .addOption(BuildOptions.get('name'))
package/src/shared.ts CHANGED
@@ -28,7 +28,6 @@ const options = {
28
28
  dry: opt('-d, --dry', 'Do not save the pack. Mostly useful with `verbose`.'),
29
29
  verbose: opt('-f, --verbose', 'Fully log all resulting resources: functions, advancements...'),
30
30
  root: opt('-r, --root', 'Save the pack & resource pack in the .minecraft/datapacks & .minecraft/resource_packs folders. Override the value specified in the configuration file.'),
31
- fullTrace: opt('-t, --full-trace', 'Show the full stack trace on errors.'),
32
31
  strictErrors: opt('-e, --strict-errors', 'Stop pack compilation on type errors.'),
33
32
  production: opt('-p, --production', 'Runs Sandstone in production mode. This sets process.env.SANDSTONE_ENV to "production".'),
34
33
 
@@ -176,7 +176,7 @@ export function WatchUI({ manual, onManualRebuild, exit }: WatchUIProps) {
176
176
  }, [isError, isManualPending, buildResult?.error, logLines.length])
177
177
 
178
178
  useInput((input, key) => {
179
- if (input === 'q') {
179
+ if (input === 'q' || (key.ctrl && input === 'c')) {
180
180
  exit!()
181
181
  }
182
182
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '2.1.0'
1
+ export const CLI_VERSION = '2.1.1'