@forgeone/cli 1.0.4 → 1.0.5
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/forge.js +14 -11
- package/package.json +6 -6
package/bin/forge.js
CHANGED
|
@@ -39,11 +39,23 @@ function resolveBinary() {
|
|
|
39
39
|
|
|
40
40
|
const [pkgName, binaryName] = entry;
|
|
41
41
|
|
|
42
|
-
// Strategy 1:
|
|
42
|
+
// Strategy 1: require.resolve — resolves the package relative to THIS file,
|
|
43
|
+
// so npm's own nesting/hoisting is respected and the version that
|
|
44
|
+
// @forgeone/cli declares as an optionalDependency is always preferred.
|
|
45
|
+
// This correctly handles the case where a different version of the platform
|
|
46
|
+
// package is installed globally at a higher level in node_modules.
|
|
47
|
+
try {
|
|
48
|
+
const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
|
|
49
|
+
const candidate = path.join(path.dirname(pkgJsonPath), "bin", binaryName);
|
|
50
|
+
if (fs.existsSync(candidate)) return candidate;
|
|
51
|
+
} catch (_) {
|
|
52
|
+
// package not on require path — fall through to directory search
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Strategy 2: Look alongside node.exe (npm global prefix) as a fallback.
|
|
43
56
|
// process.execPath = "C:\Program Files\nodejs\node.exe" (or nvm equiv).
|
|
44
57
|
// Global node_modules live at dirname(execPath)/node_modules on Windows,
|
|
45
58
|
// and at dirname(dirname(execPath))/lib/node_modules on Unix/macOS.
|
|
46
|
-
// This is robust against junction/symlink chains that confuse __dirname.
|
|
47
59
|
const nodeDir = path.dirname(process.execPath);
|
|
48
60
|
const globalCandidates = [
|
|
49
61
|
path.join(nodeDir, "node_modules", pkgName, "bin", binaryName), // Windows
|
|
@@ -53,15 +65,6 @@ function resolveBinary() {
|
|
|
53
65
|
if (fs.existsSync(candidate)) return candidate;
|
|
54
66
|
}
|
|
55
67
|
|
|
56
|
-
// Strategy 2: require.resolve — handles standard installs and NODE_PATH setups.
|
|
57
|
-
try {
|
|
58
|
-
const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
|
|
59
|
-
const candidate = path.join(path.dirname(pkgJsonPath), "bin", binaryName);
|
|
60
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
61
|
-
} catch (_) {
|
|
62
|
-
// package not on require path — fall through to directory walk
|
|
63
|
-
}
|
|
64
|
-
|
|
65
68
|
// Strategy 3: Walk up from the script path as-passed (process.argv[1]).
|
|
66
69
|
// Handles junction links: argv[1] may be the pre-resolved junction path,
|
|
67
70
|
// while __dirname is the fully-resolved real path.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgeone/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Forge CLI — AI-native developer framework. Scaffold, lint, scan, ship.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"forge",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@forgeone/cli-linux-x64": "1.0.
|
|
32
|
-
"@forgeone/cli-linux-arm64": "1.0.
|
|
33
|
-
"@forgeone/cli-darwin-x64": "1.0.
|
|
34
|
-
"@forgeone/cli-darwin-arm64": "1.0.
|
|
35
|
-
"@forgeone/cli-win32-x64": "1.0.
|
|
31
|
+
"@forgeone/cli-linux-x64": "1.0.5",
|
|
32
|
+
"@forgeone/cli-linux-arm64": "1.0.5",
|
|
33
|
+
"@forgeone/cli-darwin-x64": "1.0.5",
|
|
34
|
+
"@forgeone/cli-darwin-arm64": "1.0.5",
|
|
35
|
+
"@forgeone/cli-win32-x64": "1.0.5"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"engines": {
|