harmonyos-skills-pack 0.1.4 → 0.1.6
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/bin/cli.js +8 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* npx harmonyos-skills-pack --claude-only # 仅安装 .claude/skills
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
const { execSync } = require('child_process');
|
|
16
|
+
const { execSync, execFileSync } = require('child_process');
|
|
17
17
|
const fs = require('fs');
|
|
18
18
|
const path = require('path');
|
|
19
19
|
const os = require('os');
|
|
@@ -134,10 +134,16 @@ try {
|
|
|
134
134
|
const label = url.includes('ghproxy') ? '国内镜像' : 'GitHub';
|
|
135
135
|
console.log(` 📥 ${i > 0 ? '回退到 ' : ''}下载 (${label})`);
|
|
136
136
|
try {
|
|
137
|
-
|
|
137
|
+
const archivePath = path.join(tmpDir, 'archive.tar.gz');
|
|
138
|
+
execFileSync('curl', ['-sL', '--connect-timeout', '10', '-o', archivePath, url], {
|
|
138
139
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
139
140
|
timeout: 60000,
|
|
140
141
|
});
|
|
142
|
+
execFileSync('tar', ['-xzf', archivePath, '-C', tmpDir], {
|
|
143
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
144
|
+
timeout: 30000,
|
|
145
|
+
});
|
|
146
|
+
fs.unlinkSync(archivePath);
|
|
141
147
|
downloaded = true;
|
|
142
148
|
break;
|
|
143
149
|
} catch (e) {
|