@blocklet/component-studio-cli 0.5.13 → 0.5.15
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/utils/helper.js +8 -9
- package/package.json +1 -1
package/dist/utils/helper.js
CHANGED
|
@@ -103,7 +103,8 @@ export async function installDependencies(dirs, operation = 'install') {
|
|
|
103
103
|
const baseDepsText = operation === 'update' ? 'Updating latest dependencies...' : 'Installing latest dependencies...';
|
|
104
104
|
const depsSpinner = ora({ text: baseDepsText, color: 'blue' }).start();
|
|
105
105
|
try {
|
|
106
|
-
const installPromises = Object.entries(dirs)
|
|
106
|
+
const installPromises = Object.entries(dirs)
|
|
107
|
+
.map(([dirType, dirPath]) => {
|
|
107
108
|
return new Promise((resolve, reject) => {
|
|
108
109
|
// 检查 dir 是否存在,不存在则跳过
|
|
109
110
|
if (!existsSync(dirPath)) {
|
|
@@ -121,7 +122,7 @@ export async function installDependencies(dirs, operation = 'install') {
|
|
|
121
122
|
// ignore error
|
|
122
123
|
}
|
|
123
124
|
let errorOutput = '';
|
|
124
|
-
const depProcess = exec("npx -y taze -f -r -w -n '/arcblock|ocap|abtnode|blocklet|did-connect|did-comment|nedb/' latest && pnpm install && pnpm dedupe", {
|
|
125
|
+
const depProcess = exec("npx -y taze -f -r -w -n '/arcblock|ocap|abtnode|blocklet|did-connect|did-comment|nedb/' latest && pnpm install -f && pnpm dedupe", {
|
|
125
126
|
cwd: dirPath,
|
|
126
127
|
env: {
|
|
127
128
|
...process.env,
|
|
@@ -151,26 +152,24 @@ export async function installDependencies(dirs, operation = 'install') {
|
|
|
151
152
|
reject(new Error(`${dirType} process error: ${error.message}\n${errorOutput}`));
|
|
152
153
|
});
|
|
153
154
|
});
|
|
154
|
-
})
|
|
155
|
+
})
|
|
156
|
+
.filter((p) => p);
|
|
155
157
|
// 制作一个假进度条,每秒增加 1%
|
|
156
158
|
let progress = 0;
|
|
157
159
|
let progressStep = 1;
|
|
158
160
|
const interval = setInterval(() => {
|
|
159
161
|
if (progress < 99.9) {
|
|
160
|
-
progress = parseFloat((progress + progressStep).toFixed(
|
|
162
|
+
progress = parseFloat((progress + progressStep).toFixed(2));
|
|
161
163
|
depsSpinner.text = `${baseDepsText} ${progress}%`;
|
|
162
|
-
if (progress >=
|
|
164
|
+
if (progress >= 30) {
|
|
163
165
|
progressStep = 0.3;
|
|
164
166
|
}
|
|
165
|
-
if (progress >=
|
|
167
|
+
if (progress >= 70) {
|
|
166
168
|
progressStep = 0.2;
|
|
167
169
|
}
|
|
168
170
|
if (progress >= 90) {
|
|
169
171
|
progressStep = 0.1;
|
|
170
172
|
}
|
|
171
|
-
if (progress >= 95) {
|
|
172
|
-
progressStep = 0.05;
|
|
173
|
-
}
|
|
174
173
|
}
|
|
175
174
|
}, 1000);
|
|
176
175
|
await Promise.all(installPromises);
|