Skip to content

Commit 77ff111

Browse files
authored
Merge pull request #12 from SpawnDock/codex/dev-tunnel-fix-cli-entrypoint
fix(dev-tunnel): run cli from packaged bin shims
2 parents 7ba74d1 + bc82da1 commit 77ff111

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env node
2-
import { pathToFileURL } from "node:url";
2+
import { basename } from "node:path";
3+
import { fileURLToPath } from "node:url";
34
import { resolveConfig, type TunnelConfig } from "./config.js";
45
import { createTunnel } from "./tunnel.js";
56

@@ -29,9 +30,13 @@ export function runCli(): void {
2930
}
3031

3132
const currentEntrypoint = process.argv[1]
32-
? pathToFileURL(process.argv[1]).href
33+
? basename(process.argv[1])
3334
: "";
35+
const isCliEntrypoint =
36+
currentEntrypoint === "spawn-dock-tunnel" ||
37+
currentEntrypoint === "spawndock-tunnel" ||
38+
currentEntrypoint === basename(fileURLToPath(import.meta.url));
3439

35-
if (currentEntrypoint === import.meta.url) {
40+
if (isCliEntrypoint) {
3641
runCli();
3742
}

0 commit comments

Comments
 (0)