@uniformdev/cli 20.24.0 → 20.24.1-alpha.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.
@@ -18,6 +18,57 @@ import { mkdirSync, readFileSync, writeFileSync } from "fs";
18
18
  import { dump, load } from "js-yaml";
19
19
  import { dirname, extname, isAbsolute, resolve, sep } from "path";
20
20
  import { fetch as undiciFetch, ProxyAgent } from "undici";
21
+
22
+ // src/sync/windowsRetry.ts
23
+ var RETRIABLE_ERRORS = [
24
+ "ECONNRESET",
25
+ "ECONNREFUSED",
26
+ "ENOTFOUND",
27
+ "ETIMEDOUT",
28
+ "ESOCKETTIMEDOUT",
29
+ "read ECONNRESET",
30
+ "write ECONNRESET",
31
+ "socket hang up",
32
+ "fetch failed"
33
+ ];
34
+ var isWindows = process.platform === "win32";
35
+ var isRetriableError = (error) => {
36
+ if (!(error instanceof Error)) return false;
37
+ const errorMessage = error.message.toLowerCase();
38
+ const errorCode = error.code?.toLowerCase();
39
+ return RETRIABLE_ERRORS.some(
40
+ (pattern) => errorMessage.includes(pattern.toLowerCase()) || errorCode?.includes(pattern.toLowerCase())
41
+ );
42
+ };
43
+ var retryWithBackoff = async (operation, maxRetries = isWindows ? 5 : 3, baseDelay = isWindows ? 2e3 : 1e3, verbose = false) => {
44
+ let lastError;
45
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
46
+ try {
47
+ return await operation();
48
+ } catch (error) {
49
+ lastError = error;
50
+ if (!isRetriableError(error) || attempt === maxRetries) {
51
+ throw error;
52
+ }
53
+ const delay = baseDelay * Math.pow(2, attempt - 1) + Math.random() * 1e3;
54
+ if (verbose) {
55
+ console.log(
56
+ `\u{1F504} Retrying operation (attempt ${attempt}/${maxRetries}) after ${Math.round(delay)}ms due to: ${error.message}`
57
+ );
58
+ }
59
+ await new Promise((resolve2) => setTimeout(resolve2, delay));
60
+ }
61
+ }
62
+ throw lastError;
63
+ };
64
+ var createFetchWithRetry = (baseFetch, verbose = false) => {
65
+ return async (input, init) => {
66
+ const fetchOperation = () => baseFetch(input, init);
67
+ return retryWithBackoff(fetchOperation, 5, 2e3, verbose);
68
+ };
69
+ };
70
+
71
+ // src/sync/util.ts
21
72
  function withConfiguration(yargs) {
22
73
  return yargs.option("serialization", {
23
74
  skipValidation: true,
@@ -65,7 +116,7 @@ function nodeFetchProxy(proxy, verbose) {
65
116
  if (proxy) {
66
117
  console.log(`\u{1F991} Using proxy ${proxy}`);
67
118
  }
68
- const wrappedFetch = (input, init) => {
119
+ const baseFetch = (input, init) => {
69
120
  const handleFetchError = (e) => {
70
121
  if (e instanceof Error) {
71
122
  e.message = `Error fetching ${input.toString()}
@@ -91,6 +142,7 @@ ${e.message}`;
91
142
  handleFetchError
92
143
  );
93
144
  };
145
+ const wrappedFetch = createFetchWithRetry(baseFetch, verbose);
94
146
  if (verbose) {
95
147
  return async function fetchWithVerboseLogging(input, init) {
96
148
  const method = init?.method ?? "GET";
@@ -1,4 +1,4 @@
1
- import "./chunk-JSQVEK7R.mjs";
1
+ import "./chunk-WMBIETON.mjs";
2
2
 
3
3
  // src/sync/allSerializableEntitiesConfig.ts
4
4
  var allSerializableEntitiesConfig = {
package/dist/index.mjs CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  withFormatOptions,
17
17
  withProjectOptions,
18
18
  withTeamOptions
19
- } from "./chunk-JSQVEK7R.mjs";
19
+ } from "./chunk-WMBIETON.mjs";
20
20
 
21
21
  // src/index.ts
22
22
  import * as dotenv from "dotenv";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "20.24.0",
3
+ "version": "20.24.1-alpha.0+9e8dbc01e8",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@thi.ng/mime": "^2.2.23",
30
- "@uniformdev/assets": "20.24.0",
31
- "@uniformdev/canvas": "20.24.0",
32
- "@uniformdev/context": "20.24.0",
33
- "@uniformdev/files": "20.24.0",
34
- "@uniformdev/project-map": "20.24.0",
35
- "@uniformdev/redirect": "20.24.0",
36
- "@uniformdev/richtext": "20.24.0",
30
+ "@uniformdev/assets": "20.24.1-alpha.0+9e8dbc01e8",
31
+ "@uniformdev/canvas": "20.24.1-alpha.0+9e8dbc01e8",
32
+ "@uniformdev/context": "20.24.1-alpha.0+9e8dbc01e8",
33
+ "@uniformdev/files": "20.24.1-alpha.0+9e8dbc01e8",
34
+ "@uniformdev/project-map": "20.24.1-alpha.0+9e8dbc01e8",
35
+ "@uniformdev/redirect": "20.24.1-alpha.0+9e8dbc01e8",
36
+ "@uniformdev/richtext": "20.24.1-alpha.0+9e8dbc01e8",
37
37
  "call-bind": "^1.0.2",
38
38
  "colorette": "2.0.20",
39
39
  "cosmiconfig": "9.0.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "7d45b562619c10c1cd1824d6e03eedf7fff3bbdf"
82
+ "gitHead": "9e8dbc01e870c404b63c19326477dbb3910ec14a"
83
83
  }