superprint 1.0.40 → 1.0.42

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.
Files changed (2) hide show
  1. package/cli.mjs +17 -5
  2. 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
- const r = spawnSync('powershell', ['-NoProfile', '-Command',
109
- 'Expand-Archive -Path "' + zipPath + '" -DestinationPath "' + destDir + '" -Force'],
110
- { stdio: 'inherit' });
111
- return r.status === 0;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superprint",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "SuperPrint — free browser-based DTP (page layout) software + SP213 AI layout studio. 100% local, no CDN, no data ever leaves your machine.",
5
5
  "keywords": [
6
6
  "superprint",