@spica/cli 0.18.45 → 0.18.47
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/index.js +10 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -183,7 +183,12 @@ var httpService;
|
|
|
183
183
|
if (!error.response) {
|
|
184
184
|
return Promise.reject(error);
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
const data = error.response.data || error.response;
|
|
187
|
+
if (data instanceof Error) {
|
|
188
|
+
return Promise.reject(data);
|
|
189
|
+
}
|
|
190
|
+
const message = typeof data === "string" ? data : data?.message || data?.error || JSON.stringify(data);
|
|
191
|
+
return Promise.reject(new Error(message));
|
|
187
192
|
}
|
|
188
193
|
);
|
|
189
194
|
instance.defaults.headers.common["Authorization"] = authorization;
|
|
@@ -3656,7 +3661,7 @@ ${bold4(cyan(`\u2500\u2500 ${mod.displayName.toUpperCase()} \u2500\u2500`))} ${
|
|
|
3656
3661
|
if (!diff)
|
|
3657
3662
|
continue;
|
|
3658
3663
|
console.log(` ${bold4(section)}:`);
|
|
3659
|
-
renderUnifiedDiff(diff);
|
|
3664
|
+
renderUnifiedDiff(diff, true);
|
|
3660
3665
|
}
|
|
3661
3666
|
}
|
|
3662
3667
|
}
|
|
@@ -3724,12 +3729,12 @@ function summaryBadges(c, u, d) {
|
|
|
3724
3729
|
function dim(s) {
|
|
3725
3730
|
return `\x1B[2m${s}\x1B[0m`;
|
|
3726
3731
|
}
|
|
3727
|
-
function renderUnifiedDiff(diff) {
|
|
3732
|
+
function renderUnifiedDiff(diff, reversed = false) {
|
|
3728
3733
|
for (const line of diff.split("\n")) {
|
|
3729
3734
|
if (line.startsWith("+")) {
|
|
3730
|
-
process.stdout.write(green4(" " + line) + "\n");
|
|
3735
|
+
process.stdout.write((reversed ? red4 : green4)(" " + line) + "\n");
|
|
3731
3736
|
} else if (line.startsWith("-")) {
|
|
3732
|
-
process.stdout.write(red4(" " + line) + "\n");
|
|
3737
|
+
process.stdout.write((reversed ? green4 : red4)(" " + line) + "\n");
|
|
3733
3738
|
} else {
|
|
3734
3739
|
process.stdout.write(dim(" " + line) + "\n");
|
|
3735
3740
|
}
|