herozion 1.2.18 → 1.2.21
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/checksums.json +5 -5
- package/bin/herozion.js +23 -1
- package/install.js +51 -11
- package/package.json +1 -1
package/bin/checksums.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_comment": "SHA-256 hashes for each platform binary. Auto-generated in CI from release CHECKSUMS.sha256. DO NOT edit manually.",
|
|
3
|
-
"_version": "1.2.
|
|
4
|
-
"herozion-linux-amd64": "
|
|
5
|
-
"herozion-macos-amd64": "
|
|
6
|
-
"herozion-macos-arm64": "
|
|
7
|
-
"herozion-windows-amd64.exe": "
|
|
3
|
+
"_version": "1.2.21",
|
|
4
|
+
"herozion-linux-amd64": "bb6f1e265aeedfa1682a79bf23aa31974fc7c1574ca46de749f7ba5389701d27",
|
|
5
|
+
"herozion-macos-amd64.tar.gz": "d2bba8f4e864d0a3cb7311e0d0cd4a81b7a555ab8d22744240f8dd51c93c0abd",
|
|
6
|
+
"herozion-macos-arm64.tar.gz": "88c3c7068816511cce9e8ab5674ba9d19324969e7fd1f6a3ebe6687be3be7bd5",
|
|
7
|
+
"herozion-windows-amd64.exe": "bea4f187a14394a5c866896a1ba0b9079833af5ab6e046d5556a37699cec958a"
|
|
8
8
|
}
|
package/bin/herozion.js
CHANGED
|
@@ -18,7 +18,29 @@ const fs = require("fs");
|
|
|
18
18
|
|
|
19
19
|
const isWindows = process.platform === "win32";
|
|
20
20
|
const binaryName = isWindows ? "herozion.exe" : "herozion";
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
function resolveBinaryPath() {
|
|
23
|
+
const direct = path.join(__dirname, binaryName);
|
|
24
|
+
if (fs.existsSync(direct)) {
|
|
25
|
+
return direct;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!isWindows) {
|
|
29
|
+
const runtimeRoot = path.join(__dirname, "runtime");
|
|
30
|
+
if (fs.existsSync(runtimeRoot)) {
|
|
31
|
+
for (const entry of fs.readdirSync(runtimeRoot)) {
|
|
32
|
+
const candidate = path.join(runtimeRoot, entry, entry);
|
|
33
|
+
if (fs.existsSync(candidate)) {
|
|
34
|
+
return candidate;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return direct;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const binaryPath = resolveBinaryPath();
|
|
22
44
|
|
|
23
45
|
if (!fs.existsSync(binaryPath)) {
|
|
24
46
|
console.error(
|
package/install.js
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* Supported platforms:
|
|
21
21
|
* Windows x64 → herozion-windows-amd64.exe
|
|
22
22
|
* Linux x64 → herozion-linux-amd64
|
|
23
|
-
* macOS arm64 → herozion-macos-arm64
|
|
24
|
-
* macOS x64 → herozion-macos-amd64
|
|
23
|
+
* macOS arm64 → herozion-macos-arm64.tar.gz
|
|
24
|
+
* macOS x64 → herozion-macos-amd64.tar.gz
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
"use strict";
|
|
@@ -50,8 +50,8 @@ function getBinaryName() {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
if (platform === "linux" && (arch === "x64" || arch === "ia32")) return "herozion-linux-amd64";
|
|
53
|
-
if (platform === "darwin" && arch === "arm64") return "herozion-macos-arm64";
|
|
54
|
-
if (platform === "darwin" && (arch === "x64" || arch === "ia32")) return "herozion-macos-amd64";
|
|
53
|
+
if (platform === "darwin" && arch === "arm64") return "herozion-macos-arm64.tar.gz";
|
|
54
|
+
if (platform === "darwin" && (arch === "x64" || arch === "ia32")) return "herozion-macos-amd64.tar.gz";
|
|
55
55
|
|
|
56
56
|
throw new Error(
|
|
57
57
|
`Herozion: unsupported platform ${platform}/${arch}.\n` +
|
|
@@ -151,7 +151,36 @@ function sha256File(filePath) {
|
|
|
151
151
|
|
|
152
152
|
|
|
153
153
|
|
|
154
|
-
function
|
|
154
|
+
function isMacosTarball(binaryName) {
|
|
155
|
+
return process.platform === "darwin" && binaryName.endsWith(".tar.gz");
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function macosBundleFolder(binaryName) {
|
|
159
|
+
return binaryName.replace(/\.tar\.gz$/, "");
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function installMacosOnedirBundle(binDir, tarballPath, bundleFolder) {
|
|
163
|
+
const runtimeDir = path.join(binDir, "runtime");
|
|
164
|
+
const bundleDir = path.join(runtimeDir, bundleFolder);
|
|
165
|
+
const innerBinary = path.join(bundleDir, bundleFolder);
|
|
166
|
+
const destPath = path.join(binDir, "herozion");
|
|
167
|
+
|
|
168
|
+
if (fs.existsSync(runtimeDir)) {
|
|
169
|
+
fs.rmSync(runtimeDir, { recursive: true, force: true });
|
|
170
|
+
}
|
|
171
|
+
fs.mkdirSync(runtimeDir, { recursive: true });
|
|
172
|
+
execSync(`tar -xzf ${JSON.stringify(tarballPath)} -C ${JSON.stringify(runtimeDir)}`, {
|
|
173
|
+
stdio: "inherit",
|
|
174
|
+
});
|
|
175
|
+
if (!fs.existsSync(innerBinary)) {
|
|
176
|
+
throw new Error(`Extracted bundle missing executable: ${innerBinary}`);
|
|
177
|
+
}
|
|
178
|
+
fs.chmodSync(innerBinary, 0o755);
|
|
179
|
+
try {
|
|
180
|
+
fs.unlinkSync(destPath);
|
|
181
|
+
} catch (_) {}
|
|
182
|
+
fs.symlinkSync(path.relative(binDir, innerBinary), destPath);
|
|
183
|
+
}
|
|
155
184
|
const lifecycle = process.env.npm_lifecycle_event || "";
|
|
156
185
|
const command = process.env.npm_command || "";
|
|
157
186
|
|
|
@@ -190,20 +219,26 @@ async function main() {
|
|
|
190
219
|
|
|
191
220
|
// Skip download only when the on-disk binary matches this npm package version.
|
|
192
221
|
const markerPath = path.join(binDir, `.version-${VERSION}`);
|
|
193
|
-
|
|
222
|
+
const hasInstalledBinary = isMacosTarball(binaryName)
|
|
223
|
+
? fs.existsSync(path.join(binDir, "runtime", macosBundleFolder(binaryName), macosBundleFolder(binaryName)))
|
|
224
|
+
: fs.existsSync(destPath);
|
|
225
|
+
if (hasInstalledBinary && fs.existsSync(markerPath)) {
|
|
194
226
|
console.log(`herozion: binary v${VERSION} already present, skipping download.`);
|
|
195
227
|
return;
|
|
196
228
|
}
|
|
197
229
|
|
|
198
230
|
// Upgrade path: npm bumped the package but postinstall was skipped earlier, or an
|
|
199
231
|
// old binary (e.g. v1.1.80) is still on disk while package.json is v1.1.87.
|
|
200
|
-
if (
|
|
232
|
+
if (hasInstalledBinary && !fs.existsSync(markerPath)) {
|
|
201
233
|
console.log(
|
|
202
234
|
`herozion: replacing stale binary with v${VERSION} (previous install out of date).`
|
|
203
235
|
);
|
|
204
236
|
try {
|
|
205
237
|
fs.unlinkSync(destPath);
|
|
206
238
|
} catch (_) {}
|
|
239
|
+
try {
|
|
240
|
+
fs.rmSync(path.join(binDir, "runtime"), { recursive: true, force: true });
|
|
241
|
+
} catch (_) {}
|
|
207
242
|
try {
|
|
208
243
|
for (const entry of fs.readdirSync(binDir)) {
|
|
209
244
|
if (entry.startsWith(".version-")) {
|
|
@@ -301,10 +336,15 @@ async function main() {
|
|
|
301
336
|
);
|
|
302
337
|
}
|
|
303
338
|
|
|
304
|
-
// Verification passed —
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
fs.
|
|
339
|
+
// Verification passed — place binary (or macOS onedir bundle) on disk
|
|
340
|
+
if (isMacosTarball(binaryName)) {
|
|
341
|
+
installMacosOnedirBundle(binDir, tmpPath, macosBundleFolder(binaryName));
|
|
342
|
+
fs.unlinkSync(tmpPath);
|
|
343
|
+
} else {
|
|
344
|
+
fs.renameSync(tmpPath, destPath);
|
|
345
|
+
if (!isWindows) {
|
|
346
|
+
fs.chmodSync(destPath, 0o755);
|
|
347
|
+
}
|
|
308
348
|
}
|
|
309
349
|
// Write version marker so we don't re-download on repeated installs
|
|
310
350
|
fs.writeFileSync(markerPath, VERSION, "utf8");
|