shuimo-design / shuimo-ui

δΈ€ζ¬Ύζ°΄ε’¨ι£ŽUI
https://shuimo.design
MIT License
282 stars 24 forks source link

docs: use new `nuxi module add` command in installation #89

Closed danielroe closed 5 months ago

danielroe commented 5 months ago

πŸ€” Nature of this PR

πŸ”— Related Issue

πŸ’‘ Background and Solution

This updates the documentation to use the nuxi module add command which should simplify docs a bit and also improve user experience as there's no need to add to nuxt.config manually.

It's documented here.

I may have missed a few spots in the documentation as I'm doing this across the modules ecosystem assisted by the power of regular expressions ✨, so I'd appreciate a review πŸ™

βœ… Pre-merge Checklist

❗️Please self-check and check all options.❗️

higuaifan commented 5 months ago

Thank you for your PR!

command may neet to be changed to

npx nuxi@latest module add @shuimo-design/shuimo-ui-nuxt
image

But there will be such a prompt, is there any way to optimize it? Or is there something wrong with my usage of this command?

danielroe commented 5 months ago

You can use either the npm package name or the slug in nuxt/modules: https://github.com/nuxt/modules/blob/main/modules/shuimo-ui.yml.

The prompt seems like maybe an issue with the packaging of the module (or a bug in nuxi).

higuaifan commented 5 months ago

You can use either the npm package name or the slug in nuxt/modules: https://github.com/nuxt/modules/blob/main/modules/shuimo-ui.yml.

The prompt seems like maybe an issue with the packaging of the module (or a bug in nuxi).

πŸ€” in nuxi I found this line :

https://github.com/nuxt/cli/blob/7e0fba6b036443878b0c0f2ab1e426035c37ff0a/src/commands/module/add.ts#L246

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

but like shuimo-nuxt, 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 strict dependence 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?

danielroe commented 5 months ago

Agreed πŸ™