From 9dc594a8dcde464ace6bec0c68158b0573907b12 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 4 Nov 2025 14:42:42 +0000 Subject: [PATCH 1/5] fix(module,init,upgrade): use clack for prompts --- packages/nuxi/package.json | 1 + packages/nuxi/src/commands/init.ts | 142 ++++++++++++++--------- packages/nuxi/src/commands/module/add.ts | 71 ++++++------ packages/nuxi/src/commands/upgrade.ts | 46 +++++--- packages/nuxt-cli/package.json | 1 + pnpm-lock.yaml | 6 + 6 files changed, 159 insertions(+), 108 deletions(-) diff --git a/packages/nuxi/package.json b/packages/nuxi/package.json index 42a5a5607..d9a54bb5b 100644 --- a/packages/nuxi/package.json +++ b/packages/nuxi/package.json @@ -32,6 +32,7 @@ "prepack": "tsdown" }, "devDependencies": { + "@clack/prompts": "^0.11.0", "@nuxt/kit": "^4.2.0", "@nuxt/schema": "^4.2.0", "@nuxt/test-utils": "^3.20.1", diff --git a/packages/nuxi/src/commands/init.ts b/packages/nuxi/src/commands/init.ts index 0fdcbcc4a..e79cc48e3 100644 --- a/packages/nuxi/src/commands/init.ts +++ b/packages/nuxi/src/commands/init.ts @@ -1,10 +1,10 @@ -import type { SelectPromptOptions } from 'consola' import type { DownloadTemplateResult } from 'giget' import type { PackageManagerName } from 'nypm' import { existsSync } from 'node:fs' import process from 'node:process' +import * as clack from '@clack/prompts' import { defineCommand } from 'citty' import { colors } from 'consola/utils' import { downloadTemplate, startShell } from 'giget' @@ -170,12 +170,18 @@ export default defineCommand({ logger.info(colors.bold(`Welcome to Nuxt!`.split('').map(m => `${themeColor}${m}`).join(''))) if (ctx.args.dir === '') { - ctx.args.dir = await logger.prompt('Where would you like to create your project?', { + const result = await clack.text({ + message: 'Where would you like to create your project?', placeholder: './nuxt-app', - type: 'text', - default: 'nuxt-app', - cancel: 'reject', - }).catch(() => process.exit(1)) + defaultValue: 'nuxt-app', + }) + + if (clack.isCancel(result)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } + + ctx.args.dir = result } const cwd = resolve(ctx.args.cwd) @@ -196,28 +202,41 @@ export default defineCommand({ // when no `--force` flag is provided const shouldVerify = !shouldForce && existsSync(templateDownloadPath) if (shouldVerify) { - const selectedAction = await logger.prompt( - `The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`, - { - type: 'select', - options: ['Override its contents', 'Select different directory', 'Abort'], - }, - ) + const selectedAction = await clack.select({ + message: `The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`, + options: [ + { value: 'override', label: 'Override its contents' }, + { value: 'different', label: 'Select different directory' }, + { value: 'abort', label: 'Abort' }, + ], + }) + + if (clack.isCancel(selectedAction)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } switch (selectedAction) { - case 'Override its contents': + case 'override': shouldForce = true break - case 'Select different directory': { - templateDownloadPath = resolve(cwd, await logger.prompt('Please specify a different directory:', { - type: 'text', - cancel: 'reject', - }).catch(() => process.exit(1))) + case 'different': { + const result = await clack.text({ + message: 'Please specify a different directory:', + }) + + if (clack.isCancel(result)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } + + templateDownloadPath = resolve(cwd, result) break } - // 'Abort' or Ctrl+C + // 'Abort' + case 'abort': default: process.exit(1) } @@ -317,15 +336,26 @@ export default defineCommand({ label: pm, value: pm, hint: currentPackageManager === pm ? 'current' : undefined, - } satisfies SelectPromptOptions['options'][number])) - const selectedPackageManager = packageManagerOptions.includes(packageManagerArg) - ? packageManagerArg - : await logger.prompt('Which package manager would you like to use?', { - type: 'select', - options: packageManagerSelectOptions, - initial: currentPackageManager, - cancel: 'reject', - }).catch(() => process.exit(1)) + })) + + let selectedPackageManager: PackageManagerName + if (packageManagerOptions.includes(packageManagerArg)) { + selectedPackageManager = packageManagerArg + } + else { + const result = await clack.select({ + message: 'Which package manager would you like to use?', + options: packageManagerSelectOptions, + initialValue: currentPackageManager, + }) + + if (clack.isCancel(result)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } + + selectedPackageManager = result + } // Install project dependencies // or skip installation based on the '--no-install' flag @@ -356,10 +386,16 @@ export default defineCommand({ } if (ctx.args.gitInit === undefined) { - ctx.args.gitInit = await logger.prompt('Initialize git repository?', { - type: 'confirm', - cancel: 'reject', - }).catch(() => process.exit(1)) + const result = await clack.confirm({ + message: 'Initialize git repository?', + }) + + if (clack.isCancel(result)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } + + ctx.args.gitInit = result } if (ctx.args.gitInit) { logger.info('Initializing git repository...\n') @@ -395,14 +431,15 @@ export default defineCommand({ }[] }>('https://api.nuxt.com/modules') - const wantsUserModules = await logger.prompt( - `Would you like to install any of the official modules?`, - { - initial: false, - type: 'confirm', - cancel: 'reject', - }, - ).catch(() => process.exit(1)) + const wantsUserModules = await clack.confirm({ + message: `Would you like to install any of the official modules?`, + initialValue: false, + }) + + if (clack.isCancel(wantsUserModules)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } if (wantsUserModules) { const [response, templateDeps] = await Promise.all([ @@ -418,19 +455,16 @@ export default defineCommand({ logger.info('All official modules are already included in this template.') } else { - const selectedOfficialModules = await logger.prompt( - 'Pick the modules to install:', - { - type: 'multiselect', - options: officialModules.map(module => ({ - label: `${colors.bold(colors.greenBright(module.npm))} – ${module.description.replace(/\.$/, '')}`, - value: module.npm, - })), - required: false, - }, - ) - - if (selectedOfficialModules === undefined) { + const selectedOfficialModules = await clack.multiselect({ + message: 'Pick the modules to install:', + options: officialModules.map(module => ({ + label: `${colors.bold(colors.greenBright(module.npm))} – ${module.description.replace(/\.$/, '')}`, + value: module.npm, + })), + required: false, + }) + + if (clack.isCancel(selectedOfficialModules)) { process.exit(1) } diff --git a/packages/nuxi/src/commands/module/add.ts b/packages/nuxi/src/commands/module/add.ts index 3dabe609a..d4bf00ab3 100644 --- a/packages/nuxi/src/commands/module/add.ts +++ b/packages/nuxi/src/commands/module/add.ts @@ -8,6 +8,7 @@ import { homedir } from 'node:os' import { join } from 'node:path' import process from 'node:process' +import * as clack from '@clack/prompts' import { updateConfig } from 'c12/update' import { defineCommand } from 'citty' import { colors } from 'consola/utils' @@ -72,16 +73,12 @@ export default defineCommand({ if (!projectPkg.dependencies?.nuxt && !projectPkg.devDependencies?.nuxt) { logger.warn(`No \`nuxt\` dependency detected in \`${cwd}\`.`) - const shouldContinue = await logger.prompt( - `Do you want to continue anyway?`, - { - type: 'confirm', - initial: false, - cancel: 'default', - }, - ) + const shouldContinue = await clack.confirm({ + message: `Do you want to continue anyway?`, + initialValue: false, + }) - if (shouldContinue !== true) { + if (clack.isCancel(shouldContinue) || shouldContinue !== true) { process.exit(1) } } @@ -146,16 +143,21 @@ async function addModules(modules: ResolvedModule[], { skipInstall, skipConfig, packageManager, workspace: packageManager?.name === 'pnpm' && existsSync(resolve(cwd, 'pnpm-workspace.yaml')), }).then(() => true).catch( - (error) => { + async (error) => { logger.error(error) const failedModulesList = notInstalledModules.map(module => colors.cyan(module.pkg)).join('\`, \`') const s = notInstalledModules.length > 1 ? 's' : '' - return logger.prompt(`Install failed for \`${failedModulesList}\`. Do you want to continue adding the module${s} to ${colors.cyan('nuxt.config')}?`, { - type: 'confirm', - initial: false, - cancel: 'default', + const result = await clack.confirm({ + message: `Install failed for \`${failedModulesList}\`. Do you want to continue adding the module${s} to ${colors.cyan('nuxt.config')}?`, + initialValue: false, }) + + if (clack.isCancel(result)) { + return false + } + + return result }, ) @@ -255,15 +257,11 @@ async function resolveModule(moduleName: string, cwd: string): Promise { - const nuxtVersion: NuxtVersionTag = await logger.prompt( - 'Which nightly Nuxt release channel do you want to install? (3.x or 4.x)', - { - type: 'select', - options: ['3.x', '4.x'] as const, - default: '4.x', - cancel: 'reject', - }, - ).catch(() => process.exit(1)) + const result = await clack.select({ + message: 'Which nightly Nuxt release channel do you want to install?', + options: [ + { value: '3.x' as const, label: '3.x' }, + { value: '4.x' as const, label: '4.x' }, + ], + initialValue: '4.x' as const, + }) + + if (clack.isCancel(result)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } + + const nuxtVersion = result as NuxtVersionTag const npmPackages = packageNames.map(p => getNightlyDependency(p, nuxtVersion)) @@ -141,12 +148,9 @@ export default defineCommand({ let method: 'force' | 'dedupe' | 'skip' | undefined = ctx.args.force ? 'force' : ctx.args.dedupe ? 'dedupe' : undefined - method ||= await logger.prompt( - `Would you like to dedupe your lockfile (recommended) or recreate ${forceRemovals}? This can fix problems with hoisted dependency versions and ensure you have the most up-to-date dependencies.`, - { - type: 'select', - initial: 'dedupe', - cancel: 'reject', + if (!method) { + const result = await clack.select({ + message: `Would you like to dedupe your lockfile (recommended) or recreate ${forceRemovals}? This can fix problems with hoisted dependency versions and ensure you have the most up-to-date dependencies.`, options: [ { label: 'dedupe lockfile', @@ -162,8 +166,16 @@ export default defineCommand({ value: 'skip' as const, }, ], - }, - ).catch(() => process.exit(1)) + initialValue: 'dedupe' as const, + }) + + if (clack.isCancel(result)) { + clack.cancel('Operation cancelled.') + process.exit(1) + } + + method = result + } const versionType = ctx.args.channel === 'nightly' ? 'nightly' : `latest ${ctx.args.channel}` logger.info(`Installing ${versionType} Nuxt ${nuxtVersion} release...`) diff --git a/packages/nuxt-cli/package.json b/packages/nuxt-cli/package.json index 2669f497e..078ad2c8c 100644 --- a/packages/nuxt-cli/package.json +++ b/packages/nuxt-cli/package.json @@ -33,6 +33,7 @@ "prepack": "tsdown" }, "dependencies": { + "@clack/prompts": "^0.11.0", "c12": "^3.3.1", "citty": "^0.1.6", "confbox": "^0.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e8401bf8c..da9c420bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,6 +110,9 @@ importers: packages/nuxi: devDependencies: + '@clack/prompts': + specifier: ^0.11.0 + version: 0.11.0 '@nuxt/kit': specifier: ^4.2.0 version: 4.2.0(magicast@0.5.1) @@ -236,6 +239,9 @@ importers: packages/nuxt-cli: dependencies: + '@clack/prompts': + specifier: ^0.11.0 + version: 0.11.0 c12: specifier: ^3.3.1 version: 3.3.1(magicast@0.3.5) From 2592fe7587973e1c74474457bcfcc7b608c187ad Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 4 Nov 2025 15:35:00 +0000 Subject: [PATCH 2/5] chore: update knip config --- knip.json | 1 + 1 file changed, 1 insertion(+) diff --git a/knip.json b/knip.json index bdb68a7aa..c180871c4 100644 --- a/knip.json +++ b/knip.json @@ -28,6 +28,7 @@ "test/fixtures/*" ], "ignoreDependencies": [ + "@clack/prompts", "c12", "confbox", "consola", From edcbe97775ea659d2553d35d504f40c5b6d402d8 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 4 Nov 2025 15:36:03 +0000 Subject: [PATCH 3/5] chore: bump clack version --- packages/nuxi/package.json | 2 +- packages/nuxt-cli/package.json | 2 +- pnpm-lock.yaml | 25 +++++++++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/packages/nuxi/package.json b/packages/nuxi/package.json index d9a54bb5b..e8f1a71af 100644 --- a/packages/nuxi/package.json +++ b/packages/nuxi/package.json @@ -32,7 +32,7 @@ "prepack": "tsdown" }, "devDependencies": { - "@clack/prompts": "^0.11.0", + "@clack/prompts": "^1.0.0-alpha.6", "@nuxt/kit": "^4.2.0", "@nuxt/schema": "^4.2.0", "@nuxt/test-utils": "^3.20.1", diff --git a/packages/nuxt-cli/package.json b/packages/nuxt-cli/package.json index 078ad2c8c..7208c4622 100644 --- a/packages/nuxt-cli/package.json +++ b/packages/nuxt-cli/package.json @@ -33,7 +33,7 @@ "prepack": "tsdown" }, "dependencies": { - "@clack/prompts": "^0.11.0", + "@clack/prompts": "^1.0.0-alpha.6", "c12": "^3.3.1", "citty": "^0.1.6", "confbox": "^0.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index da9c420bc..40cf7873e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -111,8 +111,8 @@ importers: packages/nuxi: devDependencies: '@clack/prompts': - specifier: ^0.11.0 - version: 0.11.0 + specifier: ^1.0.0-alpha.6 + version: 1.0.0-alpha.6 '@nuxt/kit': specifier: ^4.2.0 version: 4.2.0(magicast@0.5.1) @@ -240,8 +240,8 @@ importers: packages/nuxt-cli: dependencies: '@clack/prompts': - specifier: ^0.11.0 - version: 0.11.0 + specifier: ^1.0.0-alpha.6 + version: 1.0.0-alpha.6 c12: specifier: ^3.3.1 version: 3.3.1(magicast@0.3.5) @@ -580,9 +580,15 @@ packages: '@clack/core@0.5.0': resolution: {integrity: sha512-p3y0FIOwaYRUPRcMO7+dlmLh8PSRcrjuTndsiA0WAFbWES0mLZlrjVoBRZ9DzkPFJZG6KGkJmoEAY0ZcVWTkow==} + '@clack/core@1.0.0-alpha.6': + resolution: {integrity: sha512-eG5P45+oShFG17u9I1DJzLkXYB1hpUgTLi32EfsMjSHLEqJUR8BOBCVFkdbUX2g08eh/HCi6UxNGpPhaac1LAA==} + '@clack/prompts@0.11.0': resolution: {integrity: sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw==} + '@clack/prompts@1.0.0-alpha.6': + resolution: {integrity: sha512-75NCtYOgDHVBE2nLdKPTDYOaESxO0GLAKC7INREp5VbS988Xua1u+588VaGlcvXiLc/kSwc25Cd+4PeTSpY6QQ==} + '@cloudflare/kv-asset-handler@0.4.0': resolution: {integrity: sha512-+tv3z+SPp+gqTIcImN9o0hqE9xyfQjI1XD9pL6NuKjua9B1y7mNYv0S9cP+QEbA4ppVgGZEmKOvHX5G5Ei1CVA==} engines: {node: '>=18.0.0'} @@ -5769,12 +5775,23 @@ snapshots: picocolors: 1.1.1 sisteransi: 1.0.5 + '@clack/core@1.0.0-alpha.6': + dependencies: + picocolors: 1.1.1 + sisteransi: 1.0.5 + '@clack/prompts@0.11.0': dependencies: '@clack/core': 0.5.0 picocolors: 1.1.1 sisteransi: 1.0.5 + '@clack/prompts@1.0.0-alpha.6': + dependencies: + '@clack/core': 1.0.0-alpha.6 + picocolors: 1.1.1 + sisteransi: 1.0.5 + '@cloudflare/kv-asset-handler@0.4.0': dependencies: mime: 3.0.0 From 21672f5aa8a195ac5273663ccb15e89ffd6ff3d6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 4 Nov 2025 16:40:43 +0000 Subject: [PATCH 4/5] refactor: use named imports for clack prompts --- packages/nuxi/src/commands/init.ts | 44 ++++++++++++------------ packages/nuxi/src/commands/module/add.ts | 22 ++++++------ packages/nuxi/src/commands/upgrade.ts | 14 ++++---- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/packages/nuxi/src/commands/init.ts b/packages/nuxi/src/commands/init.ts index 693e8955e..bf3b2f6d1 100644 --- a/packages/nuxi/src/commands/init.ts +++ b/packages/nuxi/src/commands/init.ts @@ -4,7 +4,7 @@ import type { PackageManagerName } from 'nypm' import { existsSync } from 'node:fs' import process from 'node:process' -import * as clack from '@clack/prompts' +import { box, cancel, confirm, isCancel, multiselect, select, text } from '@clack/prompts' import { defineCommand } from 'citty' import { colors } from 'consola/utils' import { downloadTemplate, startShell } from 'giget' @@ -170,14 +170,14 @@ export default defineCommand({ logger.info(colors.bold(`Welcome to Nuxt!`.split('').map(m => `${themeColor}${m}`).join(''))) if (ctx.args.dir === '') { - const result = await clack.text({ + const result = await text({ message: 'Where would you like to create your project?', placeholder: './nuxt-app', defaultValue: 'nuxt-app', }) - if (clack.isCancel(result)) { - clack.cancel('Operation cancelled.') + if (isCancel(result)) { + cancel('Operation cancelled.') process.exit(1) } @@ -202,7 +202,7 @@ export default defineCommand({ // when no `--force` flag is provided const shouldVerify = !shouldForce && existsSync(templateDownloadPath) if (shouldVerify) { - const selectedAction = await clack.select({ + const selectedAction = await select({ message: `The directory ${colors.cyan(templateDownloadPath)} already exists. What would you like to do?`, options: [ { value: 'override', label: 'Override its contents' }, @@ -211,8 +211,8 @@ export default defineCommand({ ], }) - if (clack.isCancel(selectedAction)) { - clack.cancel('Operation cancelled.') + if (isCancel(selectedAction)) { + cancel('Operation cancelled.') process.exit(1) } @@ -222,12 +222,12 @@ export default defineCommand({ break case 'different': { - const result = await clack.text({ + const result = await text({ message: 'Please specify a different directory:', }) - if (clack.isCancel(result)) { - clack.cancel('Operation cancelled.') + if (isCancel(result)) { + cancel('Operation cancelled.') process.exit(1) } @@ -343,14 +343,14 @@ export default defineCommand({ selectedPackageManager = packageManagerArg } else { - const result = await clack.select({ + const result = await select({ message: 'Which package manager would you like to use?', options: packageManagerSelectOptions, initialValue: currentPackageManager, }) - if (clack.isCancel(result)) { - clack.cancel('Operation cancelled.') + if (isCancel(result)) { + cancel('Operation cancelled.') process.exit(1) } @@ -386,12 +386,12 @@ export default defineCommand({ } if (ctx.args.gitInit === undefined) { - const result = await clack.confirm({ + const result = await confirm({ message: 'Initialize git repository?', }) - if (clack.isCancel(result)) { - clack.cancel('Operation cancelled.') + if (isCancel(result)) { + cancel('Operation cancelled.') process.exit(1) } @@ -431,13 +431,13 @@ export default defineCommand({ }[] }>('https://api.nuxt.com/modules') - const wantsUserModules = await clack.confirm({ + const wantsUserModules = await confirm({ message: `Would you like to install any of the official modules?`, initialValue: false, }) - if (clack.isCancel(wantsUserModules)) { - clack.cancel('Operation cancelled.') + if (isCancel(wantsUserModules)) { + cancel('Operation cancelled.') process.exit(1) } @@ -455,7 +455,7 @@ export default defineCommand({ logger.info('All official modules are already included in this template.') } else { - const selectedOfficialModules = await clack.multiselect({ + const selectedOfficialModules = await multiselect({ message: 'Pick the modules to install:', options: officialModules.map(module => ({ label: `${colors.bold(colors.greenBright(module.npm))} – ${module.description.replace(/\.$/, '')}`, @@ -464,7 +464,7 @@ export default defineCommand({ required: false, }) - if (clack.isCancel(selectedOfficialModules)) { + if (isCancel(selectedOfficialModules)) { process.exit(1) } @@ -512,7 +512,7 @@ export default defineCommand({ colors.cyan(`${selectedPackageManager} ${runCmd} dev`), ].filter(Boolean) - clack.box(`\n${nextSteps.map(step => ` › ${step}`).join('\n')}\n`, ` šŸ‘‰ Next steps `, { + box(`\n${nextSteps.map(step => ` › ${step}`).join('\n')}\n`, ` šŸ‘‰ Next steps `, { contentAlign: 'left', titleAlign: 'left', width: 'auto', diff --git a/packages/nuxi/src/commands/module/add.ts b/packages/nuxi/src/commands/module/add.ts index d4bf00ab3..a42a607a0 100644 --- a/packages/nuxi/src/commands/module/add.ts +++ b/packages/nuxi/src/commands/module/add.ts @@ -8,7 +8,7 @@ import { homedir } from 'node:os' import { join } from 'node:path' import process from 'node:process' -import * as clack from '@clack/prompts' +import { confirm, isCancel, select } from '@clack/prompts' import { updateConfig } from 'c12/update' import { defineCommand } from 'citty' import { colors } from 'consola/utils' @@ -73,12 +73,12 @@ export default defineCommand({ if (!projectPkg.dependencies?.nuxt && !projectPkg.devDependencies?.nuxt) { logger.warn(`No \`nuxt\` dependency detected in \`${cwd}\`.`) - const shouldContinue = await clack.confirm({ + const shouldContinue = await confirm({ message: `Do you want to continue anyway?`, initialValue: false, }) - if (clack.isCancel(shouldContinue) || shouldContinue !== true) { + if (isCancel(shouldContinue) || shouldContinue !== true) { process.exit(1) } } @@ -148,12 +148,12 @@ async function addModules(modules: ResolvedModule[], { skipInstall, skipConfig, const failedModulesList = notInstalledModules.map(module => colors.cyan(module.pkg)).join('\`, \`') const s = notInstalledModules.length > 1 ? 's' : '' - const result = await clack.confirm({ + const result = await confirm({ message: `Install failed for \`${failedModulesList}\`. Do you want to continue adding the module${s} to ${colors.cyan('nuxt.config')}?`, initialValue: false, }) - if (clack.isCancel(result)) { + if (isCancel(result)) { return false } @@ -257,11 +257,11 @@ async function resolveModule(moduleName: string, cwd: string): Promise { - const result = await clack.select({ + const result = await select({ message: 'Which nightly Nuxt release channel do you want to install?', options: [ { value: '3.x' as const, label: '3.x' }, @@ -48,8 +48,8 @@ async function getNightlyVersion(packageNames: string[]): Promise<{ npmPackages: initialValue: '4.x' as const, }) - if (clack.isCancel(result)) { - clack.cancel('Operation cancelled.') + if (isCancel(result)) { + cancel('Operation cancelled.') process.exit(1) } @@ -149,7 +149,7 @@ export default defineCommand({ let method: 'force' | 'dedupe' | 'skip' | undefined = ctx.args.force ? 'force' : ctx.args.dedupe ? 'dedupe' : undefined if (!method) { - const result = await clack.select({ + const result = await select({ message: `Would you like to dedupe your lockfile (recommended) or recreate ${forceRemovals}? This can fix problems with hoisted dependency versions and ensure you have the most up-to-date dependencies.`, options: [ { @@ -169,8 +169,8 @@ export default defineCommand({ initialValue: 'dedupe' as const, }) - if (clack.isCancel(result)) { - clack.cancel('Operation cancelled.') + if (isCancel(result)) { + cancel('Operation cancelled.') process.exit(1) } From 4add8d915ee0b0abb3ba6603e9cde60485625b8a Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 4 Nov 2025 16:43:58 +0000 Subject: [PATCH 5/5] feat: also use outro --- packages/nuxi/src/commands/init.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nuxi/src/commands/init.ts b/packages/nuxi/src/commands/init.ts index bf3b2f6d1..767a75848 100644 --- a/packages/nuxi/src/commands/init.ts +++ b/packages/nuxi/src/commands/init.ts @@ -4,7 +4,7 @@ import type { PackageManagerName } from 'nypm' import { existsSync } from 'node:fs' import process from 'node:process' -import { box, cancel, confirm, isCancel, multiselect, select, text } from '@clack/prompts' +import { box, cancel, confirm, isCancel, multiselect, outro, select, text } from '@clack/prompts' import { defineCommand } from 'citty' import { colors } from 'consola/utils' import { downloadTemplate, startShell } from 'giget' @@ -500,7 +500,7 @@ export default defineCommand({ await runCommand(addModuleCommand, args) } - logger.log(`\n✨ Nuxt project has been created with the \`${template.name}\` template.\n`) + outro(`✨ Nuxt project has been created with the \`${template.name}\` template.`) // Display next steps const relativeTemplateDir = relative(process.cwd(), template.dir) || '.'