Skip to content

Commit 9e0183c

Browse files
committed
Use tsx runtime wrapper for GitHub installs
1 parent fa131be commit 9e0183c

File tree

4 files changed

+38
-12
lines changed

4 files changed

+38
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Output format is documented in [API.md](./API.md).
1818
Global install from GitHub (short-term distribution):
1919

2020
```bash
21-
npm install -g github:PSPDFKit-labs/buildkite-cli#v0.0.4
21+
npm install -g github:PSPDFKit-labs/buildkite-cli#v0.0.5
2222
bkci --help
2323
```
2424

bin/bkci.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env node
2+
3+
import { spawn } from "node:child_process";
4+
import path from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
7+
const scriptDirectory = path.dirname(fileURLToPath(import.meta.url));
8+
const projectRoot = path.resolve(scriptDirectory, "..");
9+
const tsxCliPath = path.join(projectRoot, "node_modules", "tsx", "dist", "cli.mjs");
10+
const entryPath = path.join(projectRoot, "src", "index.ts");
11+
12+
const child = spawn(process.execPath, [tsxCliPath, entryPath, ...process.argv.slice(2)], {
13+
stdio: "inherit",
14+
});
15+
16+
child.on("exit", (code, signal) => {
17+
if (signal) {
18+
process.kill(process.pid, signal);
19+
return;
20+
}
21+
process.exit(code ?? 1);
22+
});
23+
24+
child.on("error", (error) => {
25+
process.stderr.write(`failed to launch bkci: ${error.message}\n`);
26+
process.exit(1);
27+
});

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
22
"name": "buildkite-cli",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "LLM-friendly Buildkite CLI for CI inspection.",
55
"private": true,
66
"type": "module",
77
"bin": {
8-
"bkci": "./dist/index.js"
8+
"bkci": "./bin/bkci.js"
99
},
1010
"scripts": {
1111
"build": "tsc -p tsconfig.json",
12-
"prepare": "npm run build",
1312
"dev": "tsx src/index.ts",
1413
"check": "tsc --noEmit -p tsconfig.json",
1514
"test": "pnpm run build && node --test dist/**/*.test.js"
@@ -19,10 +18,10 @@
1918
},
2019
"packageManager": "pnpm@9.15.9",
2120
"dependencies": {
22-
"typescript": "^5.9.0"
21+
"tsx": "^4.20.0"
2322
},
2423
"devDependencies": {
2524
"@types/node": "^24.0.0",
26-
"tsx": "^4.20.0"
25+
"typescript": "^5.9.0"
2726
}
2827
}

pnpm-lock.yaml

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)