@ziniao-open/cli 1.0.5 → 1.0.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/package.json +1 -1
- package/scripts/install.js +17 -3
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -153,11 +153,25 @@ function parseChecksums(text) {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
function extract(archivePath, destDir) {
|
|
156
|
+
if (process.platform === "win32" && archivePath.endsWith(".zip")) {
|
|
157
|
+
const ps = spawnSync("powershell.exe", [
|
|
158
|
+
"-NoProfile", "-NonInteractive", "-Command",
|
|
159
|
+
`Expand-Archive -LiteralPath '${archivePath}' -DestinationPath '${destDir}' -Force`
|
|
160
|
+
], { stdio: "inherit" });
|
|
161
|
+
if (!ps.error && ps.status === 0) return;
|
|
162
|
+
}
|
|
156
163
|
let tarCmd = "tar";
|
|
157
164
|
if (process.platform === "win32") {
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
const sysRoot = process.env.SystemRoot || "C:\\Windows";
|
|
166
|
+
const candidates = [
|
|
167
|
+
join(sysRoot, "Sysnative", "tar.exe"),
|
|
168
|
+
join(sysRoot, "System32", "tar.exe"),
|
|
169
|
+
];
|
|
170
|
+
for (const p of candidates) {
|
|
171
|
+
if (existsSync(p)) {
|
|
172
|
+
tarCmd = p;
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
161
175
|
}
|
|
162
176
|
}
|
|
163
177
|
const res = spawnSync(tarCmd, ["-xf", archivePath, "-C", destDir], { stdio: "inherit" });
|