feat(create-astro): --fancy (#8235)

This commit is contained in:
Nate Moore 2023-08-25 18:09:30 -05:00 committed by GitHub
parent 23096dbee8
commit 2bdce4c4a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -13,6 +13,7 @@ export interface Context {
username: string;
version: string;
skipHouston: boolean;
fancy?: boolean;
dryRun?: boolean;
yes?: boolean;
projectName?: string;
@ -88,6 +89,7 @@ export async function getContext(argv: string[]): Promise<Context> {
username,
version,
skipHouston,
fancy,
dryRun,
projectName,
template,

View file

@ -4,8 +4,9 @@ import { color, label } from '@astrojs/cli-kit';
import { random } from '@astrojs/cli-kit/utils';
import { banner, say, welcome } from '../messages.js';
export async function intro(ctx: Pick<Context, 'skipHouston' | 'version' | 'username'>) {
export async function intro(ctx: Pick<Context, 'skipHouston' | 'version' | 'username' | 'fancy'>) {
if (!ctx.skipHouston) {
const hat = ctx.fancy ? random(['🎩', '🎩', '👑', '🧢', '🍦']) : undefined;
await say([
[
'Welcome',
@ -15,7 +16,7 @@ export async function intro(ctx: Pick<Context, 'skipHouston' | 'version' | 'user
`${ctx.username}!`,
],
random(welcome),
]);
], { hat });
await banner(ctx.version);
} else {
await banner(ctx.version);