@plasmicapp/cli 0.1.248 → 0.1.250

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.
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.fixComponentImagesReferences = exports.fixComponentCssReferences = exports.syncProjectImageAssets = void 0;
16
+ const promise_pool_1 = require("@supercharge/promise-pool");
16
17
  const cli_progress_1 = __importDefault(require("cli-progress"));
17
18
  const lodash_1 = __importDefault(require("lodash"));
18
19
  const node_fetch_1 = __importDefault(require("node-fetch"));
@@ -104,7 +105,10 @@ function ensureImageAssetContents(bundles) {
104
105
  format: `Downloading images [{bar}] | {value}/{total}`,
105
106
  });
106
107
  bar.start(needsFetching.length, 0);
107
- yield Promise.all(needsFetching.map((bundle) => __awaiter(this, void 0, void 0, function* () {
108
+ yield new promise_pool_1.PromisePool()
109
+ .withConcurrency(10)
110
+ .for(needsFetching)
111
+ .process((bundle) => __awaiter(this, void 0, void 0, function* () {
108
112
  try {
109
113
  const res = yield node_fetch_1.default(bundle.blob);
110
114
  if (res.status !== 200) {
@@ -116,8 +120,9 @@ function ensureImageAssetContents(bundles) {
116
120
  }
117
121
  catch (err) {
118
122
  deps_1.logger.error(`Failed to fetch image ${bundle.fileName}: ${err}`);
123
+ throw err;
119
124
  }
120
- })));
125
+ }));
121
126
  bar.stop();
122
127
  });
123
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/cli",
3
- "version": "0.1.248",
3
+ "version": "0.1.250",
4
4
  "description": "plasmic cli for syncing local code with Plasmic designs",
5
5
  "engines": {
6
6
  "node": ">=12"
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@babel/preset-typescript": "^7.12.1",
23
- "@plasmicapp/react-web": "0.2.187",
23
+ "@plasmicapp/react-web": "0.2.188",
24
24
  "@types/cli-progress": "^3.11.0",
25
25
  "@types/findup-sync": "^2.0.2",
26
26
  "@types/glob": "^7.1.3",
@@ -53,6 +53,7 @@
53
53
  "@babel/parser": "^7.12.3",
54
54
  "@babel/traverse": "^7.12.1",
55
55
  "@sentry/node": "^5.19.2",
56
+ "@supercharge/promise-pool": "^2.4.0",
56
57
  "axios": "^0.21.1",
57
58
  "chalk": "^4.1.0",
58
59
  "cli-progress": "^3.12.0",
@@ -80,5 +81,5 @@
80
81
  "wrap-ansi": "^7.0.0",
81
82
  "yargs": "^15.4.1"
82
83
  },
83
- "gitHead": "6383173defe8d292eb68fd8e5620181cc05a37e9"
84
+ "gitHead": "5ec7f5efda583b8cac6a1cbb4c560fa0c95e7038"
84
85
  }
@@ -1,3 +1,4 @@
1
+ import { PromisePool } from "@supercharge/promise-pool";
1
2
  import cliProgress from "cli-progress";
2
3
  import L from "lodash";
3
4
  import fetch from "node-fetch";
@@ -140,14 +141,15 @@ async function ensureImageAssetContents(bundles: ImageBundle[]) {
140
141
  if (needsFetching.length === 0) {
141
142
  return;
142
143
  }
143
-
144
144
  const bar = new cliProgress.SingleBar({
145
145
  format: `Downloading images [{bar}] | {value}/{total}`,
146
146
  });
147
147
  bar.start(needsFetching.length, 0);
148
148
 
149
- await Promise.all(
150
- needsFetching.map(async (bundle) => {
149
+ await new PromisePool()
150
+ .withConcurrency(10)
151
+ .for(needsFetching)
152
+ .process(async (bundle) => {
151
153
  try {
152
154
  const res = await fetch(bundle.blob);
153
155
  if (res.status !== 200) {
@@ -160,9 +162,9 @@ async function ensureImageAssetContents(bundles: ImageBundle[]) {
160
162
  bar.increment();
161
163
  } catch (err) {
162
164
  logger.error(`Failed to fetch image ${bundle.fileName}: ${err}`);
165
+ throw err;
163
166
  }
164
- })
165
- );
167
+ });
166
168
  bar.stop();
167
169
  }
168
170