Improve Project Dependency System #28132
jogelin
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
A core concept of Nx is its ability to generate a graph of projects, which is used in many of its features.
Nx creates different types of dependencies:
package.json
.If a file has a dependency on another project, Nx will create a dependency between the two projects entirely, without making distinctions.
However, when a project serves multiple purposes or contains different types of files for various use cases, Nx does not distinguish between these roles. As a result, it is impossible to differentiate dependencies based on specific use cases.
Current
❌ Cannot Configure Different Types of Dependencies for Secondary Entry Points
There are multiple scenarios where having different types of dependencies would be useful:
❌ Cannot Configure Different Boundaries Based on File Type
The boundaries system is valuable for maintaining a clean code structure across projects. Currently, we use tags with a two-dimensional approach:
scope:*
andtype:*
to define boundaries.However, a library can serve multiple purposes:
*.spec.ts
files.*.stories.ts
files.For each use case, the list of imports may vary, and it's essential to ensure that one use case does not import irrelevant libraries.
Unfortunately, since tags are set at the library level, it is not possible to create boundaries based on file extensions.
For example, if my global boundaries using tags are as follows:
I cannot ensure that only
*.spec.ts
files from the feature-boarding library can access the shared-spec-utils library:Expected
Similar to how Nx handles the task graph, it would be interesting to add an extra layer for each project and consider that a dependency is not only from one project to another but also from one entry point to another or from one file type to another.
✅ Allow a dependency per entry point.
✅ Allow a dependency per file type or extension.
✅ Allow specialization of dependencies for a project.
Related Tickets:
Beta Was this translation helpful? Give feedback.
All reactions