portaudit 0.1.9

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/bin/portaudit +24 -0
  2. package/package.json +12 -0
package/bin/portaudit ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "node:child_process";
3
+ import { createRequire } from "node:module";
4
+ import { dirname, join } from "node:path";
5
+ import { existsSync } from "node:fs";
6
+
7
+ const require = createRequire(import.meta.url);
8
+ const pkgPath = require.resolve("@hehehai/port-audit/package.json");
9
+ const pkgDir = dirname(pkgPath);
10
+ const isWin = process.platform === "win32";
11
+
12
+ const binCandidates = [
13
+ join(pkgDir, "dist", isWin ? "port.exe" : "port"),
14
+ join(pkgDir, "bin", "port"),
15
+ ];
16
+
17
+ const binPath = binCandidates.find((candidate) => existsSync(candidate));
18
+ if (!binPath) {
19
+ console.error("portaudit: @hehehai/port-audit binary not found.");
20
+ process.exit(1);
21
+ }
22
+
23
+ const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit" });
24
+ child.on("exit", (code) => process.exit(code ?? 1));
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "portaudit",
3
+ "version": "0.1.9",
4
+ "description": "npx-friendly wrapper for @hehehai/port-audit",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "portaudit": "bin/portaudit"
8
+ },
9
+ "dependencies": {
10
+ "@hehehai/port-audit": "0.1.9"
11
+ }
12
+ }