Replies: 2 comments 1 reply
-
|
I'm just here to show my support for this. Traversing through a workspace to find the matching package name is exactly how |
Beta Was this translation helpful? Give feedback.
-
|
Alright Mr. "star dependencies are just fine except when I personally feel the consequences of them" @MylesBorins, How is this "resolved" exactly? Needing to have a self-hosted verdaccio instance for private projects is extremely cumbersome, especially when we don't want to manage yet another set of credentials. I understand that verdaccio isn't in your scope of work specifically, but we shouldn't have to use it, and not everyone's is going to be publishing on npmjs.com. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
(Copied from npm/cli#6253)
Nowadays NPM supports workspaces everywhere but there is one important feature which has currently no workspace support: Git Dependencies. It is not possible to reference a specific NPM workspace in a monorepo with a Git URL.
Let's say I have a monorepo project named
mathusing NPM workspaces to provide the modulesmath-vector,math-matrix,math-geometryandmath-probability. And I have an application projectmyappin which I want to installmath-matrixandmath-geometryvia a Git URL. This would look like this:The Git URL references the root of the monorepo which is just an empty NPM module so this currently doesn't work. And the same URL is referenced twice so most likely the repo is checked out twice which is unnecssary.
If we assume that the monorepo uses NPM workspaces then NPM can easily know that the checked out project has workspaces and also knows which workspaces are available, how they are named and which NPM modules they produce. And NPM knows the names of the requested NPM modules from the package.json of
myapp. So it shouldn't be too hard to install the correct dependencies:math-matrix)math-matrixandmath-geometryfrom the same Git repository.math-matrixdepends onmath-vectorin the same monorepo so this must be installed, too. Now NPM knows that it needs to installmath-matrix,math-vectorandmath-geometry.npm installand thennpm packfor each needed workspace to create the tarballs.myapp.Wouldn't that be a nice feature for a future NPM version? This could replace very ugly "solutions" found on the internet which involve complicated custom scripting or using specialized Github services like https://gitpkg.vercel.app/
Beta Was this translation helpful? Give feedback.
All reactions