diff --git a/package.json b/package.json index 6299d6ae..c8d91583 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "build:stub": "pnpm -r dev:prepare", "lint": "eslint .", "lint:fix": "eslint --fix .", - "nuxi": "node ./bin/nuxi.mjs", - "nuxi-bun": "bun --bun ./bin/nuxi.mjs", + "nuxi": "node ./packages/nuxi/bin/nuxi.mjs", + "nuxi-bun": "bun --bun ./packages/nuxi/bin/nuxi.mjs", "prepack": "pnpm -r build", "test:types": "tsc --noEmit", "test:knip": "knip", diff --git a/packages/nuxi/package.json b/packages/nuxi/package.json index e54af367..7cb0b265 100644 --- a/packages/nuxi/package.json +++ b/packages/nuxi/package.json @@ -2,7 +2,7 @@ "name": "nuxi", "type": "module", "version": "3.21.1", - "description": "⚡️ Nuxt Generation CLI Experience", + "description": "Nuxt CLI", "license": "MIT", "repository": { "type": "git", diff --git a/packages/nuxi/src/commands/init.ts b/packages/nuxi/src/commands/init.ts index 94cb899e..549b5076 100644 --- a/packages/nuxi/src/commands/init.ts +++ b/packages/nuxi/src/commands/init.ts @@ -5,6 +5,7 @@ import { existsSync } from 'node:fs' import process from 'node:process' import { defineCommand } from 'citty' +import { colors } from 'consola/utils' import { downloadTemplate, startShell } from 'giget' import { installDependencies } from 'nypm' import { relative, resolve } from 'pathe' @@ -78,6 +79,11 @@ export default defineCommand({ async run(ctx) { const cwd = resolve(ctx.args.cwd) + let templateDownloadPath = resolve(cwd, ctx.args.dir) + + logger.info(colors.greenBright(`Welcome to ${colors.bold(('Nuxt'))}!`)) + logger.info(`Creating a new project in ${colors.cyan(relative(cwd, templateDownloadPath) || templateDownloadPath)}.`) + // Get template name const templateName = ctx.args.template || DEFAULT_TEMPLATE_NAME @@ -86,7 +92,6 @@ export default defineCommand({ process.exit(1) } - let templateDownloadPath = resolve(cwd, ctx.args.dir) let shouldForce = Boolean(ctx.args.force) // Prompt the user if the template download directory already exists @@ -94,7 +99,7 @@ export default defineCommand({ const shouldVerify = !shouldForce && existsSync(templateDownloadPath) if (shouldVerify) { const selectedAction = await logger.prompt( - `The directory \`${templateDownloadPath}\` already exists. What would you like to do?`, + `The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`, { type: 'select', options: ['Override its contents', 'Select different directory', 'Abort'], diff --git a/packages/nuxi/src/commands/module/add.ts b/packages/nuxi/src/commands/module/add.ts index d10d8933..a509a1c6 100644 --- a/packages/nuxi/src/commands/module/add.ts +++ b/packages/nuxi/src/commands/module/add.ts @@ -309,7 +309,7 @@ async function resolveModule(moduleName: string, cwd: string): Promise | undefined if (command !== '_dev' && provider !== 'stackblitz') { diff --git a/packages/nuxi/src/utils/ascii.ts b/packages/nuxi/src/utils/ascii.ts new file mode 100644 index 00000000..4eb1e43a --- /dev/null +++ b/packages/nuxi/src/utils/ascii.ts @@ -0,0 +1,16 @@ +import { colors } from 'consola/utils' + +/** + * Thank you to Matt Eason for the proposal of this ASCII art + * https://bsky.app/profile/matteason.me/post/3lhwnl5e4g22l + */ +const icon = [ + ` __`, + ` / \\ __ `, + ` / /\\ \\/ \\ `, + ` / / \\ /\\ \\ `, + ` / /___/ / _\\ \\ `, + `/_______/ /____\\ `, +] + +export const nuxtIcon = icon.map(line => colors.greenBright(line)).join('\n') diff --git a/packages/nuxi/src/utils/logger.ts b/packages/nuxi/src/utils/logger.ts index d0d9259e..546347da 100644 --- a/packages/nuxi/src/utils/logger.ts +++ b/packages/nuxi/src/utils/logger.ts @@ -1,3 +1,4 @@ import { consola } from 'consola' +import { colors } from 'consola/utils' -export const logger = consola.withTag('nuxi') +export const logger = consola.withTag(colors.whiteBright(colors.bold(colors.bgGreenBright(' nuxi ')))) diff --git a/packages/nuxt-cli/package.json b/packages/nuxt-cli/package.json index c593a0e1..12821d8a 100644 --- a/packages/nuxt-cli/package.json +++ b/packages/nuxt-cli/package.json @@ -2,7 +2,7 @@ "name": "@nuxt/cli", "type": "module", "version": "3.21.1", - "description": "⚡️ Nuxt Generation CLI Experience", + "description": "Nuxt CLI", "license": "MIT", "repository": { "type": "git",