0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00

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

View file

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