summaryrefslogtreecommitdiff
path: root/packages/create-astro/src/messages.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/create-astro/src/messages.ts')
-rw-r--r--packages/create-astro/src/messages.ts80
1 files changed, 49 insertions, 31 deletions
diff --git a/packages/create-astro/src/messages.ts b/packages/create-astro/src/messages.ts
index 395a8b4c6..9a3bee571 100644
--- a/packages/create-astro/src/messages.ts
+++ b/packages/create-astro/src/messages.ts
@@ -1,29 +1,29 @@
/* eslint no-console: 'off' */
-import { exec } from 'node:child_process';
-import { get } from 'node:https';
import { color, label } from '@astrojs/cli-kit';
import { sleep } from '@astrojs/cli-kit/utils';
+import { exec } from 'node:child_process';
+import { get } from 'node:https';
import stripAnsi from 'strip-ansi';
export const welcome = [
- `Let's claim your corner of the internet.`,
- `I'll be your assistant today.`,
- `Let's build something awesome!`,
- `Let's build something great!`,
- `Let's build something fast!`,
- `Let's make the web weird!`,
- `Let's make the web a better place!`,
- `Let's create a new project!`,
- `Let's create something unqiue!`,
- `Time to build a new website.`,
- `Time to build a faster website.`,
- `Time to build a sweet new website.`,
- `We're glad to have you on board.`,
- `Keeping the internet weird since 2021.`,
- `Initiating launch sequence...`,
- `Initiating launch sequence... right... now!`,
- `Awaiting further instructions.`,
-]
+ `Let's claim your corner of the internet.`,
+ `I'll be your assistant today.`,
+ `Let's build something awesome!`,
+ `Let's build something great!`,
+ `Let's build something fast!`,
+ `Let's make the web weird!`,
+ `Let's make the web a better place!`,
+ `Let's create a new project!`,
+ `Let's create something unqiue!`,
+ `Time to build a new website.`,
+ `Time to build a faster website.`,
+ `Time to build a sweet new website.`,
+ `We're glad to have you on board.`,
+ `Keeping the internet weird since 2021.`,
+ `Initiating launch sequence...`,
+ `Initiating launch sequence... right... now!`,
+ `Awaiting further instructions.`,
+];
export function getName() {
return new Promise((resolve) => {
@@ -44,11 +44,10 @@ export function getName() {
let v: string;
export function getVersion() {
return new Promise<string>((resolve) => {
- if (v)
- return resolve(v);
+ if (v) return resolve(v);
get('https://registry.npmjs.org/astro/latest', (res) => {
let body = '';
- res.on('data', chunk => body += chunk);
+ res.on('data', (chunk) => (body += chunk));
res.on('end', () => {
const { version } = JSON.parse(body);
v = version;
@@ -59,7 +58,11 @@ export function getVersion() {
}
export async function banner(version: string) {
- return console.log(`\n${label('astro', color.bgGreen, color.black)} ${color.green(color.bold(`v${version}`))} ${color.bold('Launch sequence initiated.')}\n`);
+ return console.log(
+ `\n${label('astro', color.bgGreen, color.black)} ${color.green(
+ color.bold(`v${version}`)
+ )} ${color.bold('Launch sequence initiated.')}\n`
+ );
}
export async function info(prefix: string, text: string) {
@@ -83,25 +86,40 @@ export async function error(prefix: string, text: string) {
export async function typescriptByDefault() {
await info(`Cool!`, 'Astro comes with TypeScript support enabled by default.');
- console.log(`${' '.repeat(3)}${color.dim(`We'll default to the most relaxed settings for you.`)}`);
+ console.log(
+ `${' '.repeat(3)}${color.dim(`We'll default to the most relaxed settings for you.`)}`
+ );
await sleep(300);
}
-export async function nextSteps({ projectDir, devCmd }: { projectDir: string; devCmd: string; }) {
+export async function nextSteps({ projectDir, devCmd }: { projectDir: string; devCmd: string }) {
const max = process.stdout.columns;
const prefix = max < 80 ? ' ' : ' '.repeat(9);
await sleep(200);
- console.log(`\n ${color.bgCyan(` ${color.black('next')} `)} ${color.bold('Liftoff confirmed. Explore your project!')}`);
+ console.log(
+ `\n ${color.bgCyan(` ${color.black('next')} `)} ${color.bold(
+ 'Liftoff confirmed. Explore your project!'
+ )}`
+ );
await sleep(100);
if (projectDir !== '') {
- const enter = [`\n${prefix}Enter your project directory using`, color.cyan(`cd ./${projectDir}`, '')];
+ const enter = [
+ `\n${prefix}Enter your project directory using`,
+ color.cyan(`cd ./${projectDir}`, ''),
+ ];
const len = enter[0].length + stripAnsi(enter[1]).length;
- console.log(enter.join((len > max) ? '\n' + prefix : ' '));
+ console.log(enter.join(len > max ? '\n' + prefix : ' '));
}
- console.log(`${prefix}Run ${color.cyan(devCmd)} to start the dev server. ${color.cyan('CTRL+C')} to stop.`);
+ console.log(
+ `${prefix}Run ${color.cyan(devCmd)} to start the dev server. ${color.cyan('CTRL+C')} to stop.`
+ );
await sleep(100);
- console.log(`${prefix}Add frameworks like ${color.cyan(`react`)} or ${color.cyan('tailwind')} using ${color.cyan('astro add')}.`);
+ console.log(
+ `${prefix}Add frameworks like ${color.cyan(`react`)} or ${color.cyan(
+ 'tailwind'
+ )} using ${color.cyan('astro add')}.`
+ );
await sleep(100);
console.log(`\n${prefix}Stuck? Join us at ${color.cyan(`https://astro.build/chat`)}`);
await sleep(200);