Skip to content

Commit 87c3eed

Browse files
committed
feat: show greeting message
1 parent c848124 commit 87c3eed

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/cli/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@ function initNodeEnv(command: string | undefined) {
1313
}
1414
}
1515

16+
function showGreeting() {
17+
// Ensure consistent spacing before the greeting message.
18+
// Different package managers handle output formatting differently - some automatically
19+
// add a blank line before command output, while others do not.
20+
const { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env;
21+
const isNpx = npm_lifecycle_event === 'npx';
22+
const isBun = npm_execpath?.includes('.bun');
23+
const isNodeRun = Boolean(NODE_RUN_SCRIPT_NAME);
24+
const prefix = isNpx || isBun || isNodeRun ? '\n' : '';
25+
logger.greet(`${prefix}Rstack v${RSTACK_VERSION}\n`);
26+
}
27+
1628
export function runCLI(): void {
1729
const command = argv[2];
1830

1931
initNodeEnv(command);
32+
showGreeting();
2033

2134
try {
2235
setupCommands();

0 commit comments

Comments
 (0)