You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let npm run traverse monorepo directory tree up to the root before failing
With this request I would like to be able to execute npm run command that will traverse the directory tree up to the root level if it can't find a required /node_modules/.bin with executable command in subdirectory where it was executed from.
A detailed explanation and the rationale is covered in the .md file.
agorovyi
changed the title
Let npm run traverse monorepo directory tree up to the root before failing
RFC for npm run to traverse directory tree up to the root before failing
Dec 5, 2019
Ah! I had missed this PR, but I was working on the implementation for #90 today, saw the bit of code that sets up the PATH environ, and had a suspicion that this would be an issue.
In fact, rather than splitting on node_modules, it should append node_modules/.bin to every parent path. Eg, a module at /x/y/z/node_modules/a/node_modules/b would have a PATH containing:
I think it might be good to set a "project root" dir to not walk up past (ie, /x/y/z in this example), but getting that reliably is a little bit tricky, and I'm not sure it matters much.
So, I think npm v7 will satisfy you there by default.
As a corollary (which I'm not sure how or if to take advantage of?) is that we could put metadeps in ./node_modules/node_modules/, so they're accessible to anything in node_modules, but not to the root project. That could prevent unlisted deps, which are a problem in some cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let
npm runtraverse monorepo directory tree up to the root before failingWith this request I would like to be able to execute
npm runcommand that will traverse the directory tree up to the root level if it can't find a required/node_modules/.binwith executable command in subdirectory where it was executed from.A detailed explanation and the rationale is covered in the
.mdfile.