nx icon indicating copy to clipboard operation
nx copied to clipboard

nx does not find projects with `__something__` in folder name

Open sschneider-ihre-pvs opened this issue 2 years ago • 8 comments

Current Behavior

After the removal of the workspace.json it seems that nx now has problems finding projects that have __ at the start of the name and at the end of their name, or maybe other characters are excluded also. The project.json name doesn't seem to be effected though.

_generated // works
__generated // works
__generated_ // works
__generated__ // doesn't work
__generated___ //works

Expected Behavior

  1. project resolution should work independent of the folder names
  2. there should be a schema of what folder names are allowed
  3. there should be a warning of some kind that there is a project with a folder name not allowed

GitHub Repo

No response

Steps to Reproduce

  1. name a libs folder with __generated__
  2. nx show projects

Nx Report

Node : 16.14.2
   OS   : win32 x64
   pnpm : 7.27.0

   nx                      : 15.8.6
   @nrwl/js                : 15.8.6
   @nrwl/jest              : 15.8.6
   @nrwl/linter            : 15.8.6
   @nrwl/workspace         : 15.8.6
   @nrwl/cli               : 15.8.6
   @nrwl/cypress           : 15.8.6
   @nrwl/devkit            : 15.8.6
   @nrwl/eslint-plugin-nx  : 15.8.6
   @nrwl/nest              : 15.8.6
   @nrwl/node              : 15.8.6
   typescript              : 4.9.5
   ---------------------------------------
   Community plugins:
   @jscutlery/semver : 2.30.1

Failure Logs

No response

Additional Information

This bug was introduced with version 15.8.0-beta.7

sschneider-ihre-pvs avatar Mar 13 '23 10:03 sschneider-ihre-pvs

Any progress on this issue?

sschneider-ihre-pvs avatar Mar 29 '23 10:03 sschneider-ihre-pvs

Still an issue in 16.3.2

sschneider-ihre-pvs avatar Jun 05 '23 17:06 sschneider-ihre-pvs

might be related to #17426 since there is also a problem with resolution of the path in windows.

sschneider-ihre-pvs avatar Jun 05 '23 17:06 sschneider-ihre-pvs

Ok the error is even more specific. the folder with in the libs/* sub folder structure cannot start with a g

sschneider-ihre-pvs avatar Jun 15 '23 16:06 sschneider-ihre-pvs

libs/shared/rgraphql-schema-types

image

libs/shared/graphql-schema-types

image

sschneider-ihre-pvs avatar Jun 15 '23 16:06 sschneider-ihre-pvs

Additionally, when I rename the folder I have to execute nx reset too.

sschneider-ihre-pvs avatar Jun 15 '23 16:06 sschneider-ihre-pvs

guess what, after trying to do the same thing again with a different name, I am unable to reproduce a working example, now again that project fails to be found and I still have no idea why. and why only that single one.

sschneider-ihre-pvs avatar Jun 15 '23 16:06 sschneider-ihre-pvs

So what I did is:

  1. Move libs/shared/generated to libs/shared/graphql-schema-types in nx 15.6.3
  2. Migrated to latest nx
  3. run nx show projects, project does not show
  4. Renamed the folder in the explorer to libs/shared/rgraphql-schema-types
  5. run nx show projects, project does show
  6. Renamed the folder in the explorer to libs/shared/graphql-schema-types
  7. run nx show projects, project does not show

sschneider-ihre-pvs avatar Jun 16 '23 09:06 sschneider-ihre-pvs

Ok I think I found the error. https://github.com/nrwl/nx/blob/6dd652095c07cf26635b5e583249b0bdaa400902/packages/nx/src/utils/ignore.ts#L17 This change seem to have worked in the way that the actually .gitignore is now regarded in the acquiring of projects which before didn't seem to work. I generate files in the project which should be ignored but not the project itself, but since it showed up in the .gitignore since 15.8.0-beta.7 that seems to be an issue. is it possible to tell nx not to ignore any stuff from .gitignore?

sschneider-ihre-pvs avatar Jun 20 '23 16:06 sschneider-ihre-pvs

so I guess it is a bug because according to https://nx.dev/concepts/affected#ignoring-files-from-affected-commands

affected should ignore those but not the graph builder @AgentEnder

hinogi avatar Jun 20 '23 18:06 hinogi

Hey @hinogi 👋, I'm going to close this out. We have made the decision that projects should never come from files listed in .gitignore, or .nxignore. You may be able to get around this by adding !path/to/some/__project__ in .nxignore.

AgentEnder avatar Aug 17 '23 04:08 AgentEnder

Fine with me, I removed all references from the gitignore just in case :D So it works for me. I guess I have to fine grain the glob a bit better.

hinogi avatar Aug 17 '23 07:08 hinogi

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 Sep 17 '23 00:09 github-actions[bot]