MCPcopy
hub / github.com/garrytan/gstack / resolveNodeServerScript

Function resolveNodeServerScript

browse/src/cli.ts:64–81  ·  view source on GitHub ↗
(
  metaDir: string = import.meta.dir,
  execPath: string = process.execPath
)

Source from the content-addressed store, hash-verified

62 * Falls back to null if not found (server will use Bun instead).
63 */
64export function resolveNodeServerScript(
65 metaDir: string = import.meta.dir,
66 execPath: string = process.execPath
67): string | null {
68 // Dev mode
69 if (!metaDir.includes('$bunfs')) {
70 const distScript = path.resolve(metaDir, '..', 'dist', 'server-node.mjs');
71 if (fs.existsSync(distScript)) return distScript;
72 }
73
74 // Compiled binary: browse/dist/browse → browse/dist/server-node.mjs
75 if (execPath) {
76 const adjacent = path.resolve(path.dirname(execPath), 'server-node.mjs');
77 if (fs.existsSync(adjacent)) return adjacent;
78 }
79
80 return null;
81}
82
83const NODE_SERVER_SCRIPT = IS_WINDOWS ? resolveNodeServerScript() : null;
84

Callers 2

config.test.tsFile · 0.85
cli.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected