superprint 1.0.39 → 1.0.41
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/cli.mjs +17 -5
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -105,10 +105,22 @@ function downloadFile(url, dest) {
|
|
|
105
105
|
// ── Extraction ────────────────────────────────────────────────
|
|
106
106
|
function unzip(zipPath, destDir) {
|
|
107
107
|
if (isWin) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
// 🛡️ v1.7.293 : chaîne de fallbacks robuste. Expand-Archive peut échouer
|
|
109
|
+
// ("CouldNotAutoloadMatchingModule") selon la config PowerShell. On essaie
|
|
110
|
+
// ensuite PowerShell 7 (pwsh), puis tar.exe de Windows 10+ (BSDTar gère
|
|
111
|
+
// les zips — c'est le même outil qui fabrique le zip). mkdir d'abord car
|
|
112
|
+
// tar ne crée pas le répertoire de sortie.
|
|
113
|
+
try { mkdirSync(destDir, { recursive: true }); } catch (_) {}
|
|
114
|
+
const attempts = [
|
|
115
|
+
['powershell', ['-NoProfile', '-Command', 'Expand-Archive -Path "' + zipPath + '" -DestinationPath "' + destDir + '" -Force']],
|
|
116
|
+
['pwsh', ['-NoProfile', '-Command', 'Expand-Archive -Path "' + zipPath + '" -DestinationPath "' + destDir + '" -Force']],
|
|
117
|
+
['tar', ['-xf', zipPath, '-C', destDir]]
|
|
118
|
+
];
|
|
119
|
+
for (const [cmd, args] of attempts) {
|
|
120
|
+
const r = spawnSync(cmd, args, { stdio: 'inherit' });
|
|
121
|
+
if (r.status === 0 && existsSync(path.join(destDir, 'package.json'))) return true;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
112
124
|
}
|
|
113
125
|
// macOS / Linux : unzip, sinon tar, sinon python3
|
|
114
126
|
const attempts = [
|
|
@@ -118,7 +130,7 @@ function unzip(zipPath, destDir) {
|
|
|
118
130
|
];
|
|
119
131
|
for (const [cmd, args] of attempts) {
|
|
120
132
|
const r = spawnSync(cmd, args, { stdio: 'inherit' });
|
|
121
|
-
if (r.status === 0) return true;
|
|
133
|
+
if (r.status === 0 && existsSync(path.join(destDir, 'package.json'))) return true;
|
|
122
134
|
}
|
|
123
135
|
return false;
|
|
124
136
|
}
|
package/package.json
CHANGED