nuxt/cli

The problem of verifying whether it is a nuxt module when adding a module

Closed this issue · 0 comments

Hi,
I am the author of the nuxt module of shuimo-ui.
Today @danielroe reminded me to optimize the document and mentioned the use of the add module command (shuimo-design/shuimo-ui#89).
As I mentioned in this PR, I found that this happens when adding module:
image

🤔 in nuxi I found this line :

if (!pkgDependencies['nuxt'] && !pkgDependencies['nuxt-edge']) {

but like shuimo-nuxt's package.json, dependencies like this:

{
    "@nuxt/module-builder": "^0.5.5",
    "@nuxt/kit": "^3.10.3",
    "shuimo-ui": "workspace:^*"
  }

I think a streamlined nuxt module may not require nuxt or nuxt-edge,
although most of the time we dependence on nuxt, but according to the documentation and some actual scenarios, @nuxt/kit seems to be more common and necessary.

So how about adding @nuxt/kit too?

Meanwhile, I've revisited the documentation carefully and noticed the mention of Module Types.
I wonder if it might be necessary to modify the logic for judgment to some extent?
For instance, should we prioritize checking for @nuxt and @nuxtjs?

I would very much like to have some discussions with you on this matter and contribute to it!