nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.63k stars 2.36k forks source link

package.json workspaces.packages not inferred #9658

Closed elado closed 2 years ago

elado commented 2 years ago

Current Behavior

Yarn supports both

"workspaces": [
  "packages/*"
]

and

"workspaces": {
  "packages": [
    "packages/*"
  ]
}

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

Steps to Reproduce

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:
github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.