aboutsummaryrefslogtreecommitdiff
path: root/packages/create-astro/src/actions/intro.ts
blob: 0249e63c8921219ad2fb42e9256f9e0e5ea7b086 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import type { Context } from './context.js';

import { color, label } from '@astrojs/cli-kit';
import { banner, say } from '../messages.js';

export async function intro(
	ctx: Pick<Context, 'skipHouston' | 'welcome' | 'hat' | 'tie' | 'version' | 'username' | 'fancy'>,
) {
	banner();

	if (!ctx.skipHouston) {
		const { welcome, hat, tie } = ctx;
		await say(
			[
				[
					'Welcome',
					'to',
					label('astro', color.bgGreen, color.black),
					Promise.resolve(ctx.version).then(
						(version) => (version ? color.green(`v${version}`) : '') + ',',
					),
					Promise.resolve(ctx.username).then((username) => `${username}!`),
				],
				welcome ?? "Let's build something awesome!",
			] as string[],
			{ clear: true, hat, tie },
		);
	}
}