@jeancodogno/specforce-kit 0.1.6 → 0.1.8
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/index.js +46 -0
- package/package.json +8 -7
package/index.js
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* SpecForce Kit Proxy
|
|
8
|
+
* Detects the current platform/arch and executes the corresponding native binary.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const platform = process.platform;
|
|
12
|
+
const arch = process.arch;
|
|
13
|
+
const pkgName = `@jeancodogno/specforce-kit-${platform}-${arch}`;
|
|
14
|
+
|
|
15
|
+
let binaryPath;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
// 1. Try to resolve the platform-specific package
|
|
19
|
+
const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
|
|
20
|
+
const pkgDir = path.dirname(pkgJsonPath);
|
|
21
|
+
const pkgJson = require(pkgJsonPath);
|
|
22
|
+
|
|
23
|
+
// 2. Extract binary path from package.json bin field
|
|
24
|
+
const binRelativePath = typeof pkgJson.bin === 'string' ? pkgJson.bin : pkgJson.bin.specforce;
|
|
25
|
+
binaryPath = path.resolve(pkgDir, binRelativePath);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// Fallback for local development if not in node_modules
|
|
28
|
+
const localPkgDir = path.join(__dirname, 'npm', `${platform}-${arch}`);
|
|
29
|
+
try {
|
|
30
|
+
const pkgJson = require(path.join(localPkgDir, 'package.json'));
|
|
31
|
+
const binRelativePath = typeof pkgJson.bin === 'string' ? pkgJson.bin : pkgJson.bin.specforce;
|
|
32
|
+
binaryPath = path.resolve(localPkgDir, binRelativePath);
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error(`[SpecForce] Error: Native binary for ${platform}-${arch} not found.`);
|
|
35
|
+
console.error(`Requirement: The package "${pkgName}" must be installed.`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 3. Execute the binary forwarding all arguments and inheriting stdio
|
|
41
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
42
|
+
stdio: 'inherit'
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// 4. Propagate the exit code
|
|
46
|
+
process.exit(result.status ?? 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeancodogno/specforce-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "SpecForce Kit CLI - Distributed via Native Binaries",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,14 +10,15 @@
|
|
|
10
10
|
"specforce": "index.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"index.js"
|
|
13
|
+
"index.js",
|
|
14
|
+
"LICENSE"
|
|
14
15
|
],
|
|
15
16
|
"optionalDependencies": {
|
|
16
|
-
"@jeancodogno/specforce-kit-linux-x64": "0.1.
|
|
17
|
-
"@jeancodogno/specforce-kit-linux-arm64": "0.1.
|
|
18
|
-
"@jeancodogno/specforce-kit-darwin-x64": "0.1.
|
|
19
|
-
"@jeancodogno/specforce-kit-darwin-arm64": "0.1.
|
|
20
|
-
"@jeancodogno/specforce-kit-win32-x64": "0.1.
|
|
17
|
+
"@jeancodogno/specforce-kit-linux-x64": "0.1.8",
|
|
18
|
+
"@jeancodogno/specforce-kit-linux-arm64": "0.1.8",
|
|
19
|
+
"@jeancodogno/specforce-kit-darwin-x64": "0.1.8",
|
|
20
|
+
"@jeancodogno/specforce-kit-darwin-arm64": "0.1.8",
|
|
21
|
+
"@jeancodogno/specforce-kit-win32-x64": "0.1.8"
|
|
21
22
|
},
|
|
22
23
|
"author": "Jean Codogno <jeancarlo.eng.comp@gmail.com>",
|
|
23
24
|
"license": "MIT"
|