mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat: add source file execution and fix function name reference
- Add support for running CLI from TypeScript source when using tsx or similar tools - Fix outdated happy__change_title reference to hapi__change_title in codex prompt
This commit is contained in:
@@ -102,6 +102,16 @@ export function getHappyCliCommand(args: string[]): HappyCliCommand {
|
||||
const isBunRuntime = Boolean((process.versions as Record<string, string | undefined>).bun);
|
||||
const entrypoint = isBunRuntime ? resolveEntrypointForBun(projectRoot) : distEntrypoint;
|
||||
|
||||
const argv1 = process.argv[1] ?? '';
|
||||
const runningFromSource = argv1.endsWith(join('src', 'index.ts')) || process.execArgv.some((arg) => arg.includes('tsx'));
|
||||
const srcEntrypoint = join(projectRoot, 'src', 'index.ts');
|
||||
if (!isBunRuntime && runningFromSource && existsSync(srcEntrypoint)) {
|
||||
return {
|
||||
command: process.execPath,
|
||||
args: [...process.execArgv, srcEntrypoint, ...args]
|
||||
};
|
||||
}
|
||||
|
||||
const spawnArgs = isBunRuntime ? [entrypoint, ...args] : [
|
||||
'--no-warnings',
|
||||
'--no-deprecation',
|
||||
|
||||
Reference in New Issue
Block a user