coralite-scripts 0.33.1 → 0.34.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.
@@ -94,13 +94,39 @@ export function deleteDirectoryRecursive (dirPath) {
94
94
  /**
95
95
  * Prettified error display using kleur
96
96
  * @param {string} message - Error message
97
- * @param {unknown} [error] - Optional error object
97
+ * @param {object} [error] - Optional error object
98
98
  */
99
99
  export function displayError (message, error) {
100
100
  const dash = colours.gray(' ─ ')
101
101
  process.stdout.write(toTime() + colours.bgRed().white(' ERROR ') + dash + colours.red(message) + '\n')
102
102
  if (error) {
103
103
  const indent = ' '
104
+ const isCoraliteError = error.isCoraliteError || Boolean(error.cause?.isCoraliteError)
105
+
106
+ let targetError = error
107
+
108
+ // Override the targetError only if the cause is the actual CoraliteError
109
+ if (!error.isCoraliteError && error.cause?.isCoraliteError) {
110
+ targetError = error.cause
111
+ }
112
+
113
+ if (isCoraliteError) {
114
+ process.stdout.write(indent + colours.magenta('Component context:') + '\n')
115
+ if (targetError.componentId) {
116
+ process.stdout.write(indent + ' ' + colours.cyan('ID: ') + targetError.componentId + '\n')
117
+ }
118
+ if (targetError.filePath) {
119
+ process.stdout.write(indent + ' ' + colours.cyan('File: ') + targetError.filePath + '\n')
120
+ }
121
+ if (targetError.pagePath) {
122
+ process.stdout.write(indent + ' ' + colours.cyan('Page: ') + targetError.pagePath + '\n')
123
+ }
124
+ if (targetError.instanceId) {
125
+ process.stdout.write(indent + ' ' + colours.cyan('Instance: ') + targetError.instanceId + '\n')
126
+ }
127
+ process.stdout.write('\n')
128
+ }
129
+
104
130
  let errorDetails = ''
105
131
 
106
132
  if (error instanceof Error ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coralite-scripts",
3
- "version": "0.33.1",
3
+ "version": "0.34.0",
4
4
  "description": "Configuration and scripts for Create Coralite.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -61,7 +61,7 @@
61
61
  "portfinder": "^1.0.38",
62
62
  "postcss": "^8.5.6",
63
63
  "sass": "^1.91.0",
64
- "coralite": "0.33.1"
64
+ "coralite": "0.34.0"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "premove dist && pnpm build-types",