You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the import-projects generator checks if it is a new project by using the method
if ( !existingProjectJsonDirectories.some((x) => projectFile.startsWith(x)) )
However, because the filtering uses startsWith(), new projects with a path beginning the same way as an already imported project but differentiating at the end of the name are also counted as an existing project.
eg.:
We have a csproj already containing a project.json in the directory 'apps/example-app'
We create a new C# project in the directory 'apps/example-app-tests'
The same logic is also used to check if a library is new.
Expected Behavior
It is expected that the generator checks for the exact path to determine if it is an already existing project or not.
Our current solution is adding a forward slash to the end of the startsWith parameter:
if (!existingProjectJsonDirectories.some((x) => projectFile.startsWith(x + '/')))
Github Repo
No response
Steps to Reproduce
import a new project in the directory 'apps/example-app'
run the import-projects generator so that 'app/example-app' contains a project.json
import another project in the directory 'apps/example-app-test'
run the import-projects generator
the 'apps/example-app-test' project has no project.json
Current Behavior
Currently, the import-projects generator checks if it is a new project by using the method
if ( !existingProjectJsonDirectories.some((x) => projectFile.startsWith(x)) )
However, because the filtering uses
startsWith()
, new projects with a path beginning the same way as an already imported project but differentiating at the end of the name are also counted as an existing project.eg.:
We have a csproj already containing a project.json in the directory 'apps/example-app'
We create a new C# project in the directory 'apps/example-app-tests'
According to this logic:
https://github.com/nx-dotnet/nx-dotnet/blob/master/packages/core/src/generators/import-projects/generator.ts#L47
running the import-projects generator, 'apps/example-app-tests' would match the
existingProjectJsonDirectories
array as it starts the same as 'apps/example-app'The same logic is also used to check if a library is new.
Expected Behavior
It is expected that the generator checks for the exact path to determine if it is an already existing project or not.
Our current solution is adding a forward slash to the end of the startsWith parameter:
if (!existingProjectJsonDirectories.some((x) => projectFile.startsWith(x + '/')))
Github Repo
No response
Steps to Reproduce
project.json
Nx Report
nx.json
Failure Logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: