openralph 0.0.3 → 1.0.12
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/package.json +6 -9
- package/postinstall.mjs +0 -145
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openralph",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "Ralph Driven Development using OpenCode SDK and OpenTUI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ralph": "./bin/ralph"
|
|
7
7
|
},
|
|
8
|
-
"scripts": {
|
|
9
|
-
"postinstall": "node ./postinstall.mjs"
|
|
10
|
-
},
|
|
11
8
|
"optionalDependencies": {
|
|
12
|
-
"openralph-darwin-arm64": "
|
|
13
|
-
"openralph-darwin-x64": "
|
|
14
|
-
"openralph-linux-arm64": "
|
|
15
|
-
"openralph-linux-x64": "
|
|
16
|
-
"openralph-windows-x64": "
|
|
9
|
+
"openralph-darwin-arm64": "1.0.12",
|
|
10
|
+
"openralph-darwin-x64": "1.0.12",
|
|
11
|
+
"openralph-linux-arm64": "1.0.12",
|
|
12
|
+
"openralph-linux-x64": "1.0.12",
|
|
13
|
+
"openralph-windows-x64": "1.0.12"
|
|
17
14
|
},
|
|
18
15
|
"repository": {
|
|
19
16
|
"type": "git",
|
package/postinstall.mjs
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Postinstall script for openralph
|
|
4
|
-
*
|
|
5
|
-
* This script runs after `bun install -g openralph` and symlinks the
|
|
6
|
-
* platform-specific binary to the bin directory.
|
|
7
|
-
*
|
|
8
|
-
* On Windows, npm handles the .exe directly so we skip symlinking.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import fs from "fs";
|
|
12
|
-
import path from "path";
|
|
13
|
-
import os from "os";
|
|
14
|
-
import { fileURLToPath } from "url";
|
|
15
|
-
import { createRequire } from "module";
|
|
16
|
-
|
|
17
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
-
const require = createRequire(import.meta.url);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Detect the current platform and architecture
|
|
22
|
-
*/
|
|
23
|
-
function detectPlatformAndArch() {
|
|
24
|
-
let platform;
|
|
25
|
-
switch (os.platform()) {
|
|
26
|
-
case "darwin":
|
|
27
|
-
platform = "darwin";
|
|
28
|
-
break;
|
|
29
|
-
case "linux":
|
|
30
|
-
platform = "linux";
|
|
31
|
-
break;
|
|
32
|
-
case "win32":
|
|
33
|
-
platform = "windows";
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
platform = os.platform();
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let arch;
|
|
41
|
-
switch (os.arch()) {
|
|
42
|
-
case "x64":
|
|
43
|
-
arch = "x64";
|
|
44
|
-
break;
|
|
45
|
-
case "arm64":
|
|
46
|
-
arch = "arm64";
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
arch = os.arch();
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { platform, arch };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Find the platform-specific binary package
|
|
58
|
-
*/
|
|
59
|
-
function findBinary() {
|
|
60
|
-
const { platform, arch } = detectPlatformAndArch();
|
|
61
|
-
const packageName = `openralph-${platform}-${arch}`;
|
|
62
|
-
const binaryName = platform === "windows" ? "ralph.exe" : "ralph";
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
// Use require.resolve to find the package
|
|
66
|
-
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
67
|
-
const packageDir = path.dirname(packageJsonPath);
|
|
68
|
-
const binaryPath = path.join(packageDir, "bin", binaryName);
|
|
69
|
-
|
|
70
|
-
if (!fs.existsSync(binaryPath)) {
|
|
71
|
-
throw new Error(`Binary not found at ${binaryPath}`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return { binaryPath, binaryName, packageName };
|
|
75
|
-
} catch (error) {
|
|
76
|
-
throw new Error(`Could not find package ${packageName}: ${error.message}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Prepare the bin directory and return paths
|
|
82
|
-
*/
|
|
83
|
-
function prepareBinDirectory(binaryName) {
|
|
84
|
-
const binDir = path.join(__dirname, "bin");
|
|
85
|
-
const targetPath = path.join(binDir, binaryName);
|
|
86
|
-
|
|
87
|
-
// Ensure bin directory exists
|
|
88
|
-
if (!fs.existsSync(binDir)) {
|
|
89
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Remove existing binary/symlink if it exists
|
|
93
|
-
if (fs.existsSync(targetPath)) {
|
|
94
|
-
fs.unlinkSync(targetPath);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return { binDir, targetPath };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Create symlink to the platform binary
|
|
102
|
-
*/
|
|
103
|
-
function symlinkBinary(sourcePath, binaryName) {
|
|
104
|
-
const { targetPath } = prepareBinDirectory(binaryName);
|
|
105
|
-
|
|
106
|
-
fs.symlinkSync(sourcePath, targetPath);
|
|
107
|
-
console.log(`ralph binary symlinked: ${targetPath} -> ${sourcePath}`);
|
|
108
|
-
|
|
109
|
-
// Verify the file exists after operation
|
|
110
|
-
if (!fs.existsSync(targetPath)) {
|
|
111
|
-
throw new Error(`Failed to symlink binary to ${targetPath}`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Main function
|
|
117
|
-
*/
|
|
118
|
-
async function main() {
|
|
119
|
-
try {
|
|
120
|
-
// On Windows, npm handles the .exe directly via the bin field
|
|
121
|
-
// No postinstall symlinking needed
|
|
122
|
-
if (os.platform() === "win32") {
|
|
123
|
-
console.log(
|
|
124
|
-
"Windows detected: binary setup not needed (using packaged .exe)"
|
|
125
|
-
);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const { binaryPath, binaryName, packageName } = findBinary();
|
|
130
|
-
console.log(`Found ${packageName} at ${binaryPath}`);
|
|
131
|
-
symlinkBinary(binaryPath, binaryName);
|
|
132
|
-
} catch (error) {
|
|
133
|
-
console.error("Failed to setup ralph binary:", error.message);
|
|
134
|
-
// Don't fail the install - the JS launcher will handle finding the binary
|
|
135
|
-
process.exit(0);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
main();
|
|
141
|
-
} catch (error) {
|
|
142
|
-
console.error("Postinstall script error:", error.message);
|
|
143
|
-
// Exit gracefully - don't break npm install
|
|
144
|
-
process.exit(0);
|
|
145
|
-
}
|