aboutsummaryrefslogtreecommitdiff
path: root/packages/create-astro/src/actions/intro.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/create-astro/src/actions/intro.ts')
-rw-r--r--packages/create-astro/src/actions/intro.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/create-astro/src/actions/intro.ts b/packages/create-astro/src/actions/intro.ts
new file mode 100644
index 000000000..0249e63c8
--- /dev/null
+++ b/packages/create-astro/src/actions/intro.ts
@@ -0,0 +1,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 },
+ );
+ }
+}