vscode-monorepo-workspace
vscode-monorepo-workspace copied to clipboard
Can’t recognise packages in a yarn workspace/nx monorepo
I work on a Monorepo using nx and yarn workspaces. we have our packages grouped in nested directories. I wanted to try Monorepo Workspace but it only recognises our apps.
like so
./apps/
app-1/
app-2/
./packages/
common/
pkg-1/
pkg-2/
data-access/
pkg-1/
app-1/
pkg-1/
@NatoNathan
I know that I all of my packages had to have at least minimal package.json files for Monorepo Workspaces to find them.
I recently converted to using NX/yarn workspaces from using merely yarn workspaces and the following worked just fine
apps/
app1/
app2/
libs/
libA/
libB/
however, less than an hour ago I added a layer of nesting
libs/
libA/
libB/
subdirForContainingRelatedLibs/
libC/
libD/
and despite libC and libD having package.json files they aren't found.
I haven't looked at the src, but in vs code, on the extension's page, on the Feature Contributions tab lists (near the bottom)
Activation Events workspaceContains:**/package.json
I don't know if that the glob used to determine what is a "workspace" or not, as it seems to only search one directory down. I would expect it to search recursively (and merely ignore node_modules)
I thought perhaps it was stopping it's search when it finds a directory not containing a package.json, so I added a nonsensical
libs/subderForContainingRelatedLibs/package.json
{
"name": "subdirForContainingRelatedLibs",
"description": "simply a folder for containing related libs"
}
but that didn't seem have any affect.
@folke Does "sync folders" merely search the tree for directories containing package.json files and list each as a "workspace"? If so, is there some configuration which I'm not finding to tell it to search recursively, perhaps specifying that it should ignore node_modules (or some regexp/glob)?
+1
@sts125 did you find a solution
https://github.com/folke/vscode-monorepo-workspace/issues/58#issuecomment-726100699
This solved
@pyx900 nice catch! That solved my problem. Not sure if the this should get listed as a dup and closed or not. I'll leave that decision to someone else.