relative-deps icon indicating copy to clipboard operation
relative-deps copied to clipboard

Lerna support

Open aleclarson opened this issue 6 years ago • 7 comments

react-spring uses lerna in the new v9 branch. Just recently, a contributor tried using relative-deps to avoid a duplicate peer dependency, but he hit some issues (see here). Thoughts on supporting such a setup, @mweststrate?

I don't have time to dig deeper, but you can try it out by cloning the v9 branch:

git clone https://github.com/react-spring/react-spring -b v9
cd react-spring
yarn

Ideally, you would only need to use relative-deps on the package you're using directly (eg: react-spring which exists in ./packages/react-spring). Any sub-dependencies that also exist in the monorepo (eg: @react-spring/core which exists in ./packages/core) should be installed transparently.

/cc @barry4dev

aleclarson avatar Jun 28 '19 17:06 aleclarson

Thanks for raising @aleclarson. @mweststrate I feel the problem is related to the special characters in the name - If I use the same relative path but rename it react-spring-core, the build works (although it puts it in the wrong location in node_modules (inside

if I move "@react-spring/core": "../../githubProjects/react-spring/packages/core" to "react-spring-core": "../../githubProjects/react-spring/packages/core"

it builds (although the result is in the wrong place in node_modules)

Is this a current known limitation of relative-deps?

barrymay avatar Jun 28 '19 19:06 barrymay

There is currently no package name sanitizing / transformation indeed, and ends up in file paths literally at a couple of places, so yeah, probably the @ needs some special handling in a few cases. Should hopefully be easy enough to add, PR welcome :)

On Fri, Jun 28, 2019 at 9:29 PM Barry [email protected] wrote:

Thanks for raising @aleclarson https://github.com/aleclarson. @mweststrate https://github.com/mweststrate I feel the problem is related to the special characters in the name - If I use the same relative path but rename it react-spring-core, the build works (although it puts it in the wrong location in node_modules (inside

if I move "@react-spring/core": "../../githubProjects/react-spring/packages/core" to "react-spring-core": "../../githubProjects/react-spring/packages/core"

it builds (although the result is in the wrong place in node_modules)

Is this a current known limitation of relative-deps?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mweststrate/relative-deps/issues/9?email_source=notifications&email_token=AAN4NBCNENMLQCMEH4XWU4DP4ZRA3A5CNFSM4H4HIOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY267OA#issuecomment-506851256, or mute the thread https://github.com/notifications/unsubscribe-auth/AAN4NBDIA55TGNWUCZW2J2LP4ZRA3ANCNFSM4H4HIOFA .

mweststrate avatar Jun 29 '19 08:06 mweststrate

Thanks - will check it out 😉

barrymay avatar Jun 29 '19 11:06 barrymay

Separately, to @aleclarson 's actual question - is there any way to relate the sub dependencies for a package used in a monorepo or is that also a potential to-do?

barrymay avatar Jun 29 '19 12:06 barrymay

My PR fixes the folder issue, but doesn't really solve the overall issue.

I looked into this a bit further - relative-deps probably needs quite a bit of work for monorepo/lerna support, so I think unless someone wants to do the work to make it fully like yarn link, this can likely be closed ( I'll leave that to you @mweststrate ). I don't currently need it for my own purposes, since yarn link does a sufficient job.

If someone does have slashes in their package names, then this PR will now allow that to work fine IMO.

barrymay avatar Jun 29 '19 23:06 barrymay

I am not familiar myself enough with lerna to know how it precisely deals with transitive and relative dependencies (afaik it links automatically, which doesn't solve the peer dep issue). If somebody needs it, and wants to take a shot at it. I think in principle they should be able to work together, but I currently don't have any use case or test setup to verify.

mweststrate avatar Jul 05 '19 14:07 mweststrate

Released as 0.1.2

On Sun, Jun 30, 2019 at 1:32 AM Barry [email protected] wrote:

My PR fixes the folder issue, but doesn't really solve the overall issue.

I looked into this a bit further - relative-deps probably needs quite a bit of work for monorepo/lerna support, so I think unless someone wants to do the work to make it fully like yarn link, this can likely be closed ( I'll leave that to you @mweststrate https://github.com/mweststrate ). I don't currently need it for my own purposes, since yarn link does a sufficient job.

If someone does have slashes in their package names, then this PR will now allow that to work fine IMO.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mweststrate/relative-deps/issues/9?email_source=notifications&email_token=AAN4NBDG3DW77U4CEEEAG3DP47WKFA5CNFSM4H4HIOFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY4B7CY#issuecomment-506994571, or mute the thread https://github.com/notifications/unsubscribe-auth/AAN4NBDTOKVEV2PULSIWX6DP47WKFANCNFSM4H4HIOFA .

mweststrate avatar Jul 05 '19 14:07 mweststrate