Closed OriMarron closed 5 years ago
This looks great, thanks for the contribution! I tried a couple times to get this working and kept getting stuck, nice to see someone get it figured out.
I have some small pieces of feedback, would you like that now, or were you thinking of adding the yarn support to this PR (if you think yarn support may drastically change this PR, I'll wait to provide any detailed feedback until that's ready)?
Thanks!
Please provide any feedback! I will address it as soon as possible :)
I just added a commit with support for Yarn
workspaces.
It works exactly the same, apart from looking in package.json/workspaces
instead of lerna.json/packages
Awesome, I'll take a closer look today!
One question: one thing I kept getting hung up on was how to properly implement support for when VS Code / yarn / lerna workspaces are nested, e.g. a lerna workspace inside a VS Code workspace. Would that be supported with this implementation?
Ultimately not a blocker if not, as that is something that could be added incrementally. Just wanted to see if that was considered.
I actually kept it in mind, and this case is fully supported.
Let's say your workspace looks like this:
/regular-repo
/node_modules
/package.json
/lerna-repo
/node_modules
/lerna.json
/packages/project1
/package.json
/node_modules
/packages/project2
/package.json
/node_modules
you will first be prompted to choose between regular-repo
and lerna-repo
. If you chose lerna-repo
, only then you will be prompted to choose between project1
and project2
Thanks for your quick review and feedback! I committed the requested changes
Apologies for the delay, have been on vacation and forgot to circle back on this. I'll get this merged and published this weekend. Thanks again!
@jasonnutter Hi, any news on publishing a new version?
Sorry for the delay, working on it! See my comment on #13
@jasonnutter when will be a release ?
This is a suggestion to support searching the
node_modules
of child packages inlerna
monorepos.(related to #10)
background
Workspaces that use
lerna
usually have the following file structure:Currently, for workspaces with this structure, the extension will search only in the root
/node_modules
, leaving the user unable to search in one of the child projects.With this PR, the user will be prompted to select which project to search in.
Logic
The logic that is used is as follows:
If there is no
lerna.json
file at the root level - continue as beforeread
lerna.json
file, and look at thepackages
field. Example json config file:Search for packages matching the pattern(s) using
glob
. a package is a folder containing apakage.json
fileIf no packages are found - search the root
/node_modules
as beforePrompt the user to choose a project to search in: either the root or one of the packages
Search the selected project's
/node_modules
folder using the existing logicNote: patterns containing
**
are ignored for nowPlease tell me what you think. If you agree with this direction, I would gladly extend the support to also include
**
andyarn
projects. @jasonnutter