@raven.js/cli 1.0.0-alpha.14 → 1.0.0-alpha.15
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/raven +24 -0
- package/package.json +6 -6
package/bin/raven
CHANGED
|
@@ -12,6 +12,8 @@ const targets = [
|
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
let binaryPath = null;
|
|
15
|
+
|
|
16
|
+
// 方法 1: 使用 require.resolve
|
|
15
17
|
for (const target of targets) {
|
|
16
18
|
try {
|
|
17
19
|
const pkgPath = require.resolve(`@raven.js/cli-${target}`);
|
|
@@ -26,6 +28,28 @@ for (const target of targets) {
|
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
// 方法 2: 如果 require.resolve 失败,尝试手动在 node_modules 中查找
|
|
32
|
+
if (!binaryPath) {
|
|
33
|
+
let currentDir = __dirname;
|
|
34
|
+
while (currentDir && currentDir !== path.dirname(currentDir)) {
|
|
35
|
+
const nodeModulesDir = path.join(currentDir, 'node_modules');
|
|
36
|
+
if (fs.existsSync(nodeModulesDir)) {
|
|
37
|
+
for (const target of targets) {
|
|
38
|
+
const pkgDir = path.join(nodeModulesDir, '@raven.js', `cli-${target}`);
|
|
39
|
+
if (fs.existsSync(pkgDir)) {
|
|
40
|
+
const candidate = path.join(pkgDir, process.platform === 'win32' ? 'raven.exe' : 'raven');
|
|
41
|
+
if (fs.existsSync(candidate)) {
|
|
42
|
+
binaryPath = candidate;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (binaryPath) break;
|
|
48
|
+
}
|
|
49
|
+
currentDir = path.dirname(currentDir);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
29
53
|
if (!binaryPath) {
|
|
30
54
|
console.error('No compatible binary found for your platform');
|
|
31
55
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raven.js/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.15",
|
|
4
4
|
"description": "CLI tool for RavenJS framework",
|
|
5
5
|
"bin": {
|
|
6
6
|
"raven": "./bin/raven"
|
|
7
7
|
},
|
|
8
8
|
"optionalDependencies": {
|
|
9
|
-
"@raven.js/cli-linux-x64": "1.0.0-alpha.
|
|
10
|
-
"@raven.js/cli-linux-arm64": "1.0.0-alpha.
|
|
11
|
-
"@raven.js/cli-darwin-x64": "1.0.0-alpha.
|
|
12
|
-
"@raven.js/cli-darwin-arm64": "1.0.0-alpha.
|
|
13
|
-
"@raven.js/cli-windows-x64": "1.0.0-alpha.
|
|
9
|
+
"@raven.js/cli-linux-x64": "1.0.0-alpha.15",
|
|
10
|
+
"@raven.js/cli-linux-arm64": "1.0.0-alpha.15",
|
|
11
|
+
"@raven.js/cli-darwin-x64": "1.0.0-alpha.15",
|
|
12
|
+
"@raven.js/cli-darwin-arm64": "1.0.0-alpha.15",
|
|
13
|
+
"@raven.js/cli-windows-x64": "1.0.0-alpha.15"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"ravenjs",
|