Nuxt 3 Module peer dependencies version management
Hello,
I'm in a bit of a weird situation at work, where I'm trying to sort out if there is a feasible way to solve the dependency versioning in the following scenario:
We have a main Nuxt 3 app that is being developed by a separate team from us.
This Nuxt 3 app is mounting quite a few different modules created by other teams, that contains different areas and parts of the website.
The modules and the main app are consuming a lot of the same npm packages (company css, company components, i18n etc). The module developers add these as peer dependencies, which is then installed in the main app.
In our PR pipelines of the modules we clone the Nuxt app and mount a tarball of our Nuxt module to be able to test it in the main app before publishing it to our internal npm repository.
But when we (or renovatebot) have bumped peer dependencies in our modules, we can't be sure that the main app has the same version installed (most probably not since they are quite slow on bumping packages) which could lead to false positives for us, since we expect a higher version than what's installed in the main app.
I was thinking about the possibility to create a common npm package for all shared dependencies that we would add as a peer dependency in the modules, and then adding it to the main app as version "latest". But, since the nature of npm modules does not work that way (you can't import from a dependency of an installed npm package, it has to be explicitly added to package.json) I can't find a way around this issue.
I believe the setup is quite messed up but I can't really influence this since I came into this project quite late, but it's a bit frustrating to say the least.
How does people developing Nuxt modules usually cope with this? We can't be the first running into the issue, no?
Thanks for any insights you might have!
0 Replies