The fallback glob reads all package.jsons in a repo, and in case of a large monorepo that has many unrelated sources with package.jsons checked in it adds them to the graph unnecessarily. Also it makes it very slow to process.
In my case it also added some pkg/dist/package.json because that file was there, causing a duplicate package in the graph.
Expected Behavior
To read workspaces.packages if it exists and an array
Or a warning if it's malformed.
Steps to Reproduce
Configure workspaces as workspaces: { packages: [...] } in package.json
Add another folder with a package.json that isn't in the workspaces
It will be unnecessarily processed.
Environment
> NX Report complete - copy this into the issue template
Node : 16.13.1
OS : darwin arm64
yarn : 3.1.1
nx : 13.9.6
@nrwl/angular : Not Found
@nrwl/cypress : Not Found
@nrwl/detox : Not Found
@nrwl/devkit : 13.9.6
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 13.9.6
@nrwl/js : Not Found
@nrwl/linter : 13.9.6
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : Not Found
@nrwl/web : Not Found
@nrwl/workspace : 13.9.6
typescript : 4.2.4
rxjs : 6.6.7
---------------------------------------
Community plugins:
Current Behavior
Yarn supports both
and
However this code https://github.com/nrwl/nx/blob/428106f6be641757bba42376cdd689425b6461d9/packages/nx/src/config/workspaces.ts#L471-L484 only accounts for the array form, with no warning.
The fallback glob reads all package.jsons in a repo, and in case of a large monorepo that has many unrelated sources with package.jsons checked in it adds them to the graph unnecessarily. Also it makes it very slow to process.
In my case it also added some
pkg/dist/package.json
because that file was there, causing a duplicate package in the graph.Expected Behavior
workspaces.packages
if it exists and an arraySteps to Reproduce
workspaces: { packages: [...] }
in package.jsonpackage.json
that isn't in the workspacesEnvironment