ramorie 2.2.0 → 2.2.1
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/ramorie +47 -0
- package/package.json +1 -1
- package/postinstall.js +10 -1
package/bin/ramorie
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ramorie CLI - bin shim
|
|
5
|
+
*
|
|
6
|
+
* This script executes the downloaded Go binary.
|
|
7
|
+
* It's a thin wrapper that npm uses to expose the 'ramorie' command.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const { spawn } = require('child_process');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
|
|
14
|
+
// Determine binary name based on platform
|
|
15
|
+
// Binary is named ramorie-bin to avoid conflict with this shim script
|
|
16
|
+
const binaryName = process.platform === 'win32' ? 'ramorie-bin.exe' : 'ramorie-bin';
|
|
17
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
18
|
+
|
|
19
|
+
// Check if binary exists
|
|
20
|
+
if (!fs.existsSync(binaryPath)) {
|
|
21
|
+
console.error(`
|
|
22
|
+
❌ Ramorie binary not found at: ${binaryPath}
|
|
23
|
+
|
|
24
|
+
This usually means the postinstall script failed.
|
|
25
|
+
Try reinstalling: npm install -g ramorie
|
|
26
|
+
|
|
27
|
+
Or install via other methods:
|
|
28
|
+
• brew install ramorie
|
|
29
|
+
• go install github.com/terzigolu/josepshbrain-go/cmd/jbraincli@latest
|
|
30
|
+
`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Execute the binary with all arguments passed through
|
|
35
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
36
|
+
stdio: 'inherit',
|
|
37
|
+
windowsHide: true
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
child.on('error', (err) => {
|
|
41
|
+
console.error(`Failed to start ramorie: ${err.message}`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
child.on('close', (code) => {
|
|
46
|
+
process.exit(code || 0);
|
|
47
|
+
});
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -65,7 +65,8 @@ async function main() {
|
|
|
65
65
|
|
|
66
66
|
const isWindows = process.platform === 'win32';
|
|
67
67
|
const ext = isWindows ? 'zip' : 'tar.gz';
|
|
68
|
-
|
|
68
|
+
// Use different name to avoid overwriting the shim script
|
|
69
|
+
const binaryName = isWindows ? 'ramorie-bin.exe' : 'ramorie-bin';
|
|
69
70
|
|
|
70
71
|
const assetName = `ramorie_${VERSION}_${platform}_${arch}.${ext}`;
|
|
71
72
|
const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${assetName}`;
|
|
@@ -90,11 +91,19 @@ async function main() {
|
|
|
90
91
|
|
|
91
92
|
// Extract using system tools
|
|
92
93
|
console.log(' Extracting...');
|
|
94
|
+
const extractedBinary = isWindows ? 'ramorie.exe' : 'ramorie';
|
|
95
|
+
const extractedPath = path.join(binDir, extractedBinary);
|
|
96
|
+
|
|
93
97
|
if (isWindows) {
|
|
94
98
|
execSync(`powershell -command "Expand-Archive -Path '${tempFile}' -DestinationPath '${binDir}' -Force"`, { stdio: 'pipe' });
|
|
95
99
|
} else {
|
|
96
100
|
execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'pipe' });
|
|
97
101
|
}
|
|
102
|
+
|
|
103
|
+
// Rename to avoid overwriting the shim script
|
|
104
|
+
if (fs.existsSync(extractedPath)) {
|
|
105
|
+
fs.renameSync(extractedPath, binaryPath);
|
|
106
|
+
}
|
|
98
107
|
console.log(' ✓ Extracted');
|
|
99
108
|
|
|
100
109
|
// Make executable (Unix only)
|