lingo.dev 0.97.5 → 0.98.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/build/cli.cjs +45 -1
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +45 -1
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.mjs
CHANGED
|
@@ -204,6 +204,26 @@ var CLIError = class extends Error {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
|
|
207
|
+
// src/cli/utils/cloudflare-status.ts
|
|
208
|
+
async function checkCloudflareStatus() {
|
|
209
|
+
try {
|
|
210
|
+
const response = await fetch("https://www.cloudflarestatus.com/api/v2/status.json", {
|
|
211
|
+
signal: AbortSignal.timeout(5e3)
|
|
212
|
+
});
|
|
213
|
+
if (response.ok) {
|
|
214
|
+
return await response.json();
|
|
215
|
+
}
|
|
216
|
+
} catch (error) {
|
|
217
|
+
}
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
function formatCloudflareStatusMessage(status) {
|
|
221
|
+
if (status.status.indicator === "none") {
|
|
222
|
+
return "";
|
|
223
|
+
}
|
|
224
|
+
return `Cloudflare is experiencing ${status.status.indicator} issues: ${status.status.description}. This may be affecting the API connection.`;
|
|
225
|
+
}
|
|
226
|
+
|
|
207
227
|
// src/cli/utils/auth.ts
|
|
208
228
|
function createAuthenticator(params) {
|
|
209
229
|
return {
|
|
@@ -226,8 +246,32 @@ function createAuthenticator(params) {
|
|
|
226
246
|
id: payload.id
|
|
227
247
|
};
|
|
228
248
|
}
|
|
249
|
+
if (res.status >= 500 && res.status < 600) {
|
|
250
|
+
const originalErrorMessage = `Server error (${res.status}): ${res.statusText}. Please try again later.`;
|
|
251
|
+
const cloudflareStatus = await checkCloudflareStatus();
|
|
252
|
+
if (!cloudflareStatus) {
|
|
253
|
+
throw new CLIError({
|
|
254
|
+
message: originalErrorMessage,
|
|
255
|
+
docUrl: "connectionFailed"
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (cloudflareStatus.status.indicator !== "none") {
|
|
259
|
+
const cloudflareMessage = formatCloudflareStatusMessage(cloudflareStatus);
|
|
260
|
+
throw new CLIError({
|
|
261
|
+
message: cloudflareMessage,
|
|
262
|
+
docUrl: "connectionFailed"
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
throw new CLIError({
|
|
266
|
+
message: originalErrorMessage,
|
|
267
|
+
docUrl: "connectionFailed"
|
|
268
|
+
});
|
|
269
|
+
}
|
|
229
270
|
return null;
|
|
230
271
|
} catch (error) {
|
|
272
|
+
if (error instanceof CLIError) {
|
|
273
|
+
throw error;
|
|
274
|
+
}
|
|
231
275
|
const isNetworkError = error instanceof TypeError && error.message === "fetch failed";
|
|
232
276
|
if (isNetworkError) {
|
|
233
277
|
throw new CLIError({
|
|
@@ -7494,7 +7538,7 @@ async function renderHero2() {
|
|
|
7494
7538
|
// package.json
|
|
7495
7539
|
var package_default = {
|
|
7496
7540
|
name: "lingo.dev",
|
|
7497
|
-
version: "0.
|
|
7541
|
+
version: "0.98.0",
|
|
7498
7542
|
description: "Lingo.dev CLI",
|
|
7499
7543
|
private: false,
|
|
7500
7544
|
publishConfig: {
|