@odarino/haren 1.1.1 → 1.1.3
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 +5 -2
- package/postinstall.mjs +72 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@odarino/haren",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Minimal skill-based agentic SDLC framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
-
"content"
|
|
26
|
+
"content",
|
|
27
|
+
"postinstall.mjs"
|
|
27
28
|
],
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"access": "public"
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
},
|
|
34
35
|
"scripts": {
|
|
35
36
|
"dev": "bun run src/index.ts",
|
|
37
|
+
"postinstall": "node postinstall.mjs",
|
|
36
38
|
"build": "bun run scripts/copy-content.ts && bun build src/index.ts --target=bun --outdir dist",
|
|
37
39
|
"prepublishOnly": "bun run build",
|
|
38
40
|
"test": "bun test",
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@biomejs/biome": "latest",
|
|
46
|
+
"@haren/shared": "workspace:*",
|
|
44
47
|
"@types/bun": "latest"
|
|
45
48
|
},
|
|
46
49
|
"peerDependencies": {
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Runs after `haren` is installed. The published binary has a `#!/usr/bin/env bun`
|
|
3
|
+
// shebang, so package managers generate a shim that launches `bun`. If the user
|
|
4
|
+
// doesn't have Bun installed, that shim fails with "bun(.exe) not recognized".
|
|
5
|
+
//
|
|
6
|
+
// This script checks for Bun and installs it automatically when missing, so
|
|
7
|
+
// `haren` works regardless of whether the user already had Bun.
|
|
8
|
+
//
|
|
9
|
+
// Must stay plain Node (no Bun APIs) — it runs before Bun is guaranteed to exist.
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
|
|
12
|
+
const SKIP = process.env.HAREN_SKIP_BUN_INSTALL;
|
|
13
|
+
const isWindows = process.platform === "win32";
|
|
14
|
+
|
|
15
|
+
function log(msg) {
|
|
16
|
+
console.log(`[haren] ${msg}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function bunIsInstalled() {
|
|
20
|
+
// `bun --version` resolves bun/bun.exe/bun.cmd via PATH using the OS shell.
|
|
21
|
+
const probe = spawnSync("bun", ["--version"], {
|
|
22
|
+
stdio: "ignore",
|
|
23
|
+
shell: true,
|
|
24
|
+
});
|
|
25
|
+
return probe.status === 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function installBun() {
|
|
29
|
+
if (isWindows) {
|
|
30
|
+
log("Bun not found — installing via bun.sh (PowerShell)...");
|
|
31
|
+
return spawnSync(
|
|
32
|
+
"powershell",
|
|
33
|
+
["-NoProfile", "-Command", "irm https://bun.sh/install.ps1 | iex"],
|
|
34
|
+
{ stdio: "inherit" },
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
log("Bun not found — installing via bun.sh ...");
|
|
38
|
+
return spawnSync("bash", ["-c", "curl -fsSL https://bun.sh/install | bash"], {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function main() {
|
|
44
|
+
if (SKIP) {
|
|
45
|
+
log("HAREN_SKIP_BUN_INSTALL set — skipping Bun check.");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (bunIsInstalled()) {
|
|
50
|
+
log("Bun is already installed — nothing to do.");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const result = installBun();
|
|
55
|
+
|
|
56
|
+
if (result.error || result.status !== 0) {
|
|
57
|
+
log("Could not install Bun automatically.");
|
|
58
|
+
log("haren requires the Bun runtime. Install it manually, then re-run:");
|
|
59
|
+
log(
|
|
60
|
+
isWindows
|
|
61
|
+
? ' powershell -c "irm https://bun.sh/install.ps1 | iex"'
|
|
62
|
+
: " curl -fsSL https://bun.sh/install | bash",
|
|
63
|
+
);
|
|
64
|
+
log("More info: https://bun.sh/docs/installation");
|
|
65
|
+
// Do not fail the install — the package files are already in place.
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
log("Bun installed. Open a NEW terminal so PATH updates, then run `haren`.");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
main();
|