herozion 1.2.17 → 1.2.19

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.
@@ -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.17",
4
- "herozion-linux-amd64": "52d8e78dd757efa9e7573c01fc686299802a1d3ce16e05e423e70a9c3fa1a8fe",
5
- "herozion-macos-amd64": "e36540b6fc5faad7dd55959e3e3b82033cbb74dea277b17c5578059a430bea38",
6
- "herozion-macos-arm64": "510ab1d701ee5de81026ad043250d48c19b3213ee7034f67dea9b9c99ad99e8a",
7
- "herozion-windows-amd64.exe": "cf5741bc695a18e545be13292e2cafd8ce590a6189810c35784b170654538810"
3
+ "_version": "1.2.19",
4
+ "herozion-linux-amd64": "50fcbd8e420554d188c3e6e79d95ad36e67a43c1cc944a0da99ebfd0d6a0ac2a",
5
+ "herozion-macos-amd64.tar.gz": "31d3c7cdb70ef5ddb01294685f5964e00c0a58e5eb4f8a87e89b0a134dc75edd",
6
+ "herozion-macos-arm64.tar.gz": "9a04354b02ace79015ea3e7c4aa7a60b6f78e55dd0916ccb100cfdd4eb8a9a7e",
7
+ "herozion-windows-amd64.exe": "4769290d70dda885c8ee6529ccf93fd5dd1ed6e81bdec2ae7db6fdb978e58fc9"
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
- const binaryPath = path.join(__dirname, binaryName);
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 shouldSkipInstall() {
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
- if (fs.existsSync(destPath) && fs.existsSync(markerPath)) {
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 (fs.existsSync(destPath) && !fs.existsSync(markerPath)) {
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 — move binary into place
305
- fs.renameSync(tmpPath, destPath);
306
- if (!isWindows) {
307
- fs.chmodSync(destPath, 0o755);
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herozion",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "Security audit and performance analysis CLI tool for developers",
5
5
  "keywords": [
6
6
  "security",