skill-os 0.1.2 → 0.1.3
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/skill-os.js +15 -5
package/package.json
CHANGED
package/skill-os.js
CHANGED
|
@@ -346,13 +346,23 @@ function cmdDownload(skillPath, options) {
|
|
|
346
346
|
console.log(` Target: ${chalk.cyan(targetDir)}\n`);
|
|
347
347
|
|
|
348
348
|
try {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
//
|
|
352
|
-
execSync(`curl -s -L "${
|
|
349
|
+
const tmpZip = path.join(require('os').tmpdir(), `skill-${Date.now()}.zip`);
|
|
350
|
+
|
|
351
|
+
// Download the zip file to OS tmp dir
|
|
352
|
+
execSync(`curl -s -L -o "${tmpZip}" "${downloadUrl}"`);
|
|
353
|
+
|
|
354
|
+
// Extract the zip to target directory
|
|
355
|
+
// -q: quiet, -o: overwrite
|
|
356
|
+
execSync(`unzip -q -o "${tmpZip}" -d "${targetDir}"`);
|
|
357
|
+
|
|
358
|
+
// Cleanup temp file
|
|
359
|
+
if (fs.existsSync(tmpZip)) {
|
|
360
|
+
fs.unlinkSync(tmpZip);
|
|
361
|
+
}
|
|
362
|
+
|
|
353
363
|
console.log(`\n${chalk.green(`✓ Successfully downloaded and extracted to: ${targetDir}`)}`);
|
|
354
364
|
} catch (e) {
|
|
355
|
-
console.error(`\n${chalk.red(`✗ Failed to download. The API may have returned an error
|
|
365
|
+
console.error(`\n${chalk.red(`✗ Failed to download. The API may have returned an error, or 'unzip' is not installed.`)}`);
|
|
356
366
|
process.exit(1);
|
|
357
367
|
}
|
|
358
368
|
}
|