ardent-cli 0.0.11 → 0.0.12
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/dist/index.js +12 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -151,10 +151,21 @@ function getCliVersion() {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
var CLI_VERSION = getCliVersion();
|
|
154
|
+
function formatErrorDetail(detail) {
|
|
155
|
+
if (typeof detail === "string") return detail;
|
|
156
|
+
if (Array.isArray(detail)) {
|
|
157
|
+
return detail.map((entry) => {
|
|
158
|
+
const location = Array.isArray(entry.loc) ? entry.loc.join(" \u2192 ") : "";
|
|
159
|
+
const message = entry.msg ?? "unknown error";
|
|
160
|
+
return location ? `${location}: ${message}` : String(message);
|
|
161
|
+
}).join("; ");
|
|
162
|
+
}
|
|
163
|
+
return JSON.stringify(detail);
|
|
164
|
+
}
|
|
154
165
|
function parseApiError(status, text) {
|
|
155
166
|
try {
|
|
156
167
|
const json = JSON.parse(text);
|
|
157
|
-
if (json.detail) return `API error ${status}: ${json.detail}`;
|
|
168
|
+
if (json.detail) return `API error ${status}: ${formatErrorDetail(json.detail)}`;
|
|
158
169
|
} catch {
|
|
159
170
|
}
|
|
160
171
|
return `API error ${status}: ${text}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ardent-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Git for Data infrastructure",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsup",
|
|
11
11
|
"dev": "tsup --watch",
|
|
12
|
-
"start": "node dist/index.js"
|
|
12
|
+
"start": "node dist/index.js",
|
|
13
|
+
"test": "tsx --test src/lib/*.test.ts"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"dist"
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@types/node": "^20.0.0",
|
|
26
27
|
"tsup": "^8.0.0",
|
|
28
|
+
"tsx": "^4.21.0",
|
|
27
29
|
"typescript": "^5.0.0"
|
|
28
30
|
}
|
|
29
31
|
}
|