foxguard 0.7.0 → 0.8.0
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/README.md +1 -1
- package/bin/foxguard +6 -42
- package/package.json +2 -2
package/README.md
CHANGED
package/bin/foxguard
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { execFileSync
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const os = require("os");
|
|
@@ -48,35 +48,6 @@ function getBinaryName() {
|
|
|
48
48
|
return os.platform() === "win32" ? "foxguard.exe" : "foxguard";
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// Check if cargo-installed foxguard exists
|
|
52
|
-
function findCargoInstall() {
|
|
53
|
-
try {
|
|
54
|
-
const cargoHome = process.env.CARGO_HOME || path.join(os.homedir(), ".cargo");
|
|
55
|
-
const cargoBin = path.join(cargoHome, "bin", getBinaryName());
|
|
56
|
-
if (fs.existsSync(cargoBin)) {
|
|
57
|
-
return cargoBin;
|
|
58
|
-
}
|
|
59
|
-
} catch {}
|
|
60
|
-
|
|
61
|
-
// Try PATH
|
|
62
|
-
try {
|
|
63
|
-
const which = os.platform() === "win32" ? "where" : "which";
|
|
64
|
-
const result = execSync(`${which} foxguard 2>/dev/null`, {
|
|
65
|
-
encoding: "utf8",
|
|
66
|
-
}).trim();
|
|
67
|
-
if (result && !result.includes("node_modules")) {
|
|
68
|
-
// Resolve symlinks to avoid finding ourselves (the npm wrapper)
|
|
69
|
-
const resolved = fs.realpathSync(result);
|
|
70
|
-
const thisScript = fs.realpathSync(__filename);
|
|
71
|
-
if (resolved !== thisScript) {
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} catch {}
|
|
76
|
-
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
51
|
function download(url) {
|
|
81
52
|
return new Promise((resolve, reject) => {
|
|
82
53
|
const get = (u) => {
|
|
@@ -151,18 +122,11 @@ async function downloadBinary() {
|
|
|
151
122
|
}
|
|
152
123
|
|
|
153
124
|
async function main() {
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return;
|
|
160
|
-
} catch (e) {
|
|
161
|
-
process.exit(e.status || 1);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// 2. Download or use cached binary
|
|
125
|
+
// Always resolve to the binary matching the npm package version. A
|
|
126
|
+
// previously-installed foxguard on PATH (cargo, Homebrew, etc.) may be
|
|
127
|
+
// an older version that does not understand newer subcommands, so we
|
|
128
|
+
// ignore it. Users who want their own foxguard can invoke it directly
|
|
129
|
+
// instead of via `npx`.
|
|
166
130
|
const bin = await downloadBinary();
|
|
167
131
|
try {
|
|
168
132
|
execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxguard",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "A security scanner as fast as a linter, written in Rust. 170+ built-in rules across 10 languages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|