fix(nx-monorepo): ensure output targets are unique #509
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is possible for users to define multiple duplicate outputs in their project.json. This is leading to fs related issues like ENOTEMPTY: directory not empty, rmdir. The reason this occurs is that the src will tried to be copied to the cached directory in parallel for all output paths (even duplicated ones) and is the reason why these errors are seen sporadically. By ensuring output paths are unique, we only ever copy one path which resolves this issue.
Note: There may still be an issue present if there is a glob that is overlapping another directory i.e: cdk.out/* and cdk.out, however have not been able to reproduce a fs error while testing.
This PR acts as a stopgap until the following PR is merged in NX 18207
fix #488