framework icon indicating copy to clipboard operation
framework copied to clipboard

feat(nuxi): manage modules via cli

Open Intevel opened this issue 2 years ago • 7 comments

🔗 Linked issue

https://github.com/nuxt/rfcs/issues/31 https://github.com/nuxt/framework/discussions/569 #3915

❓ Type of change

  • [x] 📖 Documentation (updates to the documentation or readme)
  • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ ] 👌 Enhancement (improving an existing functionality like performance)
  • [x] ✨ New feature (a non-breaking change that adds functionality)
  • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

With the new commands you can now add different Nuxt 3 modules (& bridge) to the project via Nuxi. The given module name is matched with a list that is currently still done manually (maybe in the future an API?), the name is matched to prevent that not Nuxt modules are installed. The module is added to the .nuxtrc file which is merged with the normal nuxt config.

carbon

📝 Checklist

  • [x] I have linked an issue or discussion.
  • [x] I have updated the documentation accordingly.

Intevel avatar Mar 31 '22 16:03 Intevel

Deploy Preview for nuxt3-docs failed.

Name Link
Latest commit 0836c8646060aaa4cbf25b69e23ac3e1618496a2
Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/63445478cbc3a500089b552a

netlify[bot] avatar Mar 31 '22 16:03 netlify[bot]

@Baroshem

Intevel avatar Mar 31 '22 16:03 Intevel

Thanks for the PR @Intevel. Some notes:

  • Please disable local linter (prettier) and run yarn lint --fix
  • We can start with nuxi module add <npm name> syntax (later integrate with nuxt modules DB but is not straight forward)
  • lmify is deprecated. Working on a new package. It is not safe to rely on.

pi0 avatar Mar 31 '22 16:03 pi0

Thank you @pi0. I had already talked with @Atinux that we draft this PR for now. I fixed the linting & disabled prettier. Currently have some kind of manual DB inserted with names, similar to slugs. That would be just an idea.

Intevel avatar Mar 31 '22 17:03 Intevel

Thank you for the PR :)

Agree to start with nuxi module add <npm name> since it allow anyone to use new packages that are not officially listed.

atinux avatar Apr 01 '22 07:04 atinux

Thanks for the PR @Intevel. Some notes:

  • Please disable local linter (prettier) and run yarn lint --fix

  • We can start with nuxi module add <npm name> syntax (later integrate with nuxt modules DB but is not straight forward)

  • lmify is deprecated. Working on a new package. It is not safe to rely on.

@pi0 https://github.com/Intevel/qpind Maybe this instead of lmify for this?

Intevel avatar Apr 03 '22 11:04 Intevel

Nice work on qpind @Intevel 💚 However we already have antfu/install-pkg and other solutions, I would still wait for new unjs package designed for nuxi and nuxt universal integration.

pi0 avatar Apr 04 '22 07:04 pi0

Folks, can we start working on this feature again? I think this would be an awesome DX improvement to the Nuxi tool. I can help with implementing this as well :)

Baroshem avatar Oct 09 '22 12:10 Baroshem

Surely, so the package installing can we do with install-pkg but where do we get the data from to check if this is a nuxt module or not?

Intevel avatar Oct 09 '22 13:10 Intevel

Can't we just parse the user input against a regexp and if it includes the nuxt keywoard assume that it is a module? @nuxt/@nuxtjs/nuxt-something should all work with that. I think even right now, you will only handle properly the modules that are in the modules array so we can always log to the user (Module not found in the supported modules DB/array, please configure the module by yourself)

Baroshem avatar Oct 09 '22 14:10 Baroshem

@pi0 What do you think? Is a regex in this case the best way?

Intevel avatar Oct 09 '22 14:10 Intevel

@Baroshem pushed some new stuff, what are you're thoughts about it? (btw i know its not an regex, wrong commit message)

Intevel avatar Oct 10 '22 17:10 Intevel

@Intevel

Yes, this is what I meant in my proposition in the Discord channel. Nice work! Now, let's wait for Pio, Daniel, or Sebastien to give their opinion and recommend next steps :)

Baroshem avatar Oct 12 '22 09:10 Baroshem

@Intevel Did you close this intentionally?

TheAlexLichter avatar Nov 16 '22 12:11 TheAlexLichter

@Intevel Did you close this intentionally?

This PR is now 8 months old. i doubt we'll get this feature in yet, if so i'll redevelop it. For PR #9055 I have synced my fork and so the old changes are lost. All good

Intevel avatar Nov 16 '22 12:11 Intevel

Supporting module management from CLI is definitely one thing we always dreamt of having but has been tricky so far because we lacked the CLI infra and AST modification tool to make it happen.

Would be happy to have you on board in next weeks on this feature @Intevel and sorry was delayed in the roadmap.

pi0 avatar Nov 16 '22 12:11 pi0

Supporting module management from CLI is definitely one thing we always dreamt of having but has been tricky so far because we lacked the CLI infra and AST modification tool to make it happen.

Would be happy to have you on board in next weeks on this feature @Intevel and sorry was delayed in the roadmap.

All right, I'm happy to be there. We can talk about it again as soon as it goes to the feature. I find the module management via the CLI quite good, maybe I open this PR again with a new PoC.

Intevel avatar Nov 16 '22 12:11 Intevel

I can help with this as well. Just let me know :)

Baroshem avatar Nov 16 '22 13:11 Baroshem

Nice to hear, thank you.

Intevel avatar Nov 16 '22 13:11 Intevel