nuxt / nuxt/devtools

fix: selecting 'n' when running `devtools enable|disable` throws error

Open
#344 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
3.3k
Forks
214
Avg merge
13h 22m
Merged PRs (30d)
18

Description

🐛 The bug

Created a new v3 nuxt app. devtools is listed as enabled by default in the generated config file:

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true }
})

Upon trying to disable dev tools via npx nuxi@latest devtools disable it prompted me to install the devtools-wizard:

❯ npx nuxi@latest devtools disable
Nuxi 3.6.5                                                                                                                                                                                            
Need to install the following packages:
  @nuxt/devtools-wizard@0.7.1
Ok to proceed? (y)

If i enter n (or anything not y), it throws an error.

Ok to proceed? (y) n
npm ERR! canceled

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gilzow/.npm/_logs/2023-07-26T20_47_43_752Z-debug-0.log

 ERROR  Command failed with exit code 1: npx @nuxt/devtools-wizard@latest disable /Users/gilzow/projects/delete/nuxt-test/mynuxtapp                                                                   3:48:43 PM

  at makeError (/Users/gilzow/.npm/_npx/b95349761371180e/node_modules/nuxi/dist/shared/nuxi.e25041ef.mjs:619:11)
  at handlePromise (/Users/gilzow/.npm/_npx/b95349761371180e/node_modules/nuxi/dist/shared/nuxi.e25041ef.mjs:1108:26)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async Object.invoke (/Users/gilzow/.npm/_npx/b95349761371180e/node_modules/nuxi/dist/chunks/devtools.mjs:40:5)
  at async _main (/Users/gilzow/.npm/_npx/b95349761371180e/node_modules/nuxi/dist/cli.mjs:49:20)

Same thing happens if I do npx nuxi@latest devtools enable and select anything that isn't y at the prompt.

🛠️ To reproduce

n/a

🌈 Expected behavior

if the user selects n, the cli should simply exit

ℹ️ Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the devtools enable and devtools disable CLI commands, especially where they invoke the devtools wizard. Reproduce the prompt with npx nuxi@latest devtools enable or disable and choose a non-y response; done means the command exits cleanly without reporting an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
cli, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.