nx icon indicating copy to clipboard operation
nx copied to clipboard

Nx considers any arbitrary project.json file as nx project file

Open hasanayan opened this issue 2 years ago • 4 comments

Current Behavior

after migrating from nx 14.7.5 to to 15.3.3, I started getting this error;

Screenshot 2022-12-15 at 13 42 46

that folder XXX/public/locales/de has project.json, but that project name stands for the project in our app domain. As far as I understood, Nx thinks there is an nx project in that folder and complains about that.

Expected Behavior

  • Be able to tell nx to ignore folders from discovering them as nx libs
  • Or, be able to completely turn off project.json discovery, because we are using workspace.json anyway

Github Repo

No response

Steps to Reproduce

  1. add project.json anywhere in an nx lib and run nx workspace-lint

Nx Report

>  NX   Report complete - copy this into the issue template

   Node : 16.15.0
   OS   : darwin arm64
   yarn : 3.2.0
   
   nx : 15.3.3
   @nrwl/angular : Not Found
   @nrwl/cypress : 15.3.3
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.3.3
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.3.3
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.3.3
   @nrwl/js : 15.3.3
   @nrwl/linter : 15.3.3
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : 15.3.3
   @nrwl/react : 15.3.3
   @nrwl/react-native : Not Found
   @nrwl/rollup : 15.3.3
   @nrwl/schematics : Not Found
   @nrwl/storybook : 15.3.3
   @nrwl/web : 15.3.3
   @nrwl/webpack : 15.3.3
   @nrwl/workspace : 15.3.3
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         rxjs: 6.6.7
         @wanews/nx-vite: 0.10.1

Failure Logs

No response

Additional Information

No response

hasanayan avatar Dec 15 '22 10:12 hasanayan

This probably can be solved with project inference plugins, but the example you gave in the docs is not clear.

How is that plugin created? is it enough to create libs/awesome-plugin/index.ts? Apparently not, that did not work for me. The other plugins I know are generators and executors, and project-inference doesn't seem to fit those

hasanayan avatar Dec 15 '22 12:12 hasanayan

Hey! This should probably be addresed, but in the meantime you can add that file to .nxignore to avoid it being picked up. One thing to note is that file will no longer be hashed when calculating cache hits if added there.

AgentEnder avatar Dec 15 '22 19:12 AgentEnder

thanks, @AgentEnder, I worked around this issue by renaming my project.json ( which led to renaming whole bunch of other stuff but that's my problem : ) )

But, yeah, nx should offer a better way to tackle this.

hasanayan avatar Dec 16 '22 10:12 hasanayan

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar Jun 15 '23 00:06 github-actions[bot]

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.

github-actions[bot] avatar Jul 31 '23 00:07 github-actions[bot]