dk-frontend-skills 3.0.2 → 3.0.4
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/package.json +1 -1
- package/scripts/cli.js +5 -5
- package/scripts/core.js +0 -9
package/package.json
CHANGED
package/scripts/cli.js
CHANGED
|
@@ -93,9 +93,10 @@ async function downloadAndInstallSkill(name, index) {
|
|
|
93
93
|
if (fs.existsSync(destDir)) fs.rmSync(destDir, { recursive: true, force: true });
|
|
94
94
|
fs.mkdirSync(destDir, { recursive: true });
|
|
95
95
|
|
|
96
|
-
await tar.x({ file: tempFile, C: destDir });
|
|
96
|
+
await tar.x({ file: tempFile, C: destDir, strip: 1 });
|
|
97
97
|
|
|
98
98
|
fs.rmSync(tempFile, { force: true });
|
|
99
|
+
console.log(` ✓ ${name}`);
|
|
99
100
|
return true;
|
|
100
101
|
} catch (err) {
|
|
101
102
|
bar.stop();
|
|
@@ -249,15 +250,14 @@ async function startInteractiveMenu() {
|
|
|
249
250
|
loop: false,
|
|
250
251
|
});
|
|
251
252
|
|
|
252
|
-
const
|
|
253
|
+
const installed = await installSelectedSkills(selected);
|
|
254
|
+
|
|
253
255
|
const removedCount = [...installedSet].filter(
|
|
254
256
|
(name) => !selected.includes(name),
|
|
255
257
|
).length;
|
|
256
258
|
|
|
257
|
-
const installed = await installSelectedSkills(selected);
|
|
258
|
-
|
|
259
259
|
const parts = [];
|
|
260
|
-
if (
|
|
260
|
+
if (installed > 0) parts.push(`+${installed}`);
|
|
261
261
|
if (removedCount > 0) parts.push(`-${removedCount}`);
|
|
262
262
|
const summary = parts.length > 0 ? ` ${parts.join(" ")}` : "";
|
|
263
263
|
|
package/scripts/core.js
CHANGED
|
@@ -230,15 +230,6 @@ async function downloadFile(url, destPath, onProgress) {
|
|
|
230
230
|
throw new Error(`HTTP ${response.status} ${response.statusText}`);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
// 检查 Content-Type,如果不是 gzip 大概率是 404 页面
|
|
234
|
-
const contentType = response.headers.get("content-type") || "";
|
|
235
|
-
if (!contentType.includes("gzip") && !contentType.includes("octet-stream") && !contentType.includes("binary")) {
|
|
236
|
-
const text = await response.clone().text();
|
|
237
|
-
if (text.includes("<!doctype") || text.includes("<html")) {
|
|
238
|
-
throw new Error("下载链接无效,请检查 GitHub Release 是否存在");
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
233
|
const total = parseInt(response.headers.get("content-length") || "0", 10);
|
|
243
234
|
let downloaded = 0;
|
|
244
235
|
|