cli icon indicating copy to clipboard operation
cli copied to clipboard

Detecting if cwd doesn't contain a Nuxt project

Open adhamfarrag opened this issue 2 years ago • 3 comments

Default behavior for using the CLI in a directory without nuxt.config.ts is installing, then creating the Nuxt config file and adding the module. Can we check if nuxt.config.ts exists first ?

Thinking behavior should be either showing a YES/NO question to create it and proceed? Or, just killing the process.

adhamfarrag avatar Sep 19 '23 17:09 adhamfarrag

@pi0 Happy to do the PR. :)

adhamfarrag avatar Sep 19 '23 17:09 adhamfarrag

Certainly! PR more than welcome to add this guard. I think we need to check either of pages/ dir, nuxt.config or app.vue files exist. (to avoid edge cases, we might show a consola.prompt and ask hey this seems not a valid dir, do you really want to continue?)

pi0 avatar Sep 19 '23 18:09 pi0

I think it should be one rule checking if it's Nuxt project or not (searching for config file) and to be added to the add/module commands.

adhamfarrag avatar Sep 19 '23 18:09 adhamfarrag