ZachJW34 / nx-plus

Collection of Nx Community Plugins
MIT License
302 stars 51 forks source link

Current status of dep-graph patcher? #258

Open leggomuhgreggo opened 2 years ago

leggomuhgreggo commented 2 years ago

Description

We've been running into some latency issues on some peoples machines with the postinstall script, and I was curious about the status of this workaround.

I went to check on the issue referenced in the docs and the issue appears to have been closed, with a note announcing support for depgraph extension API.

This feature landed a while back, in Nx 12.X. With support for the dep-graph extension documented, implemented, and released I'm going to close out this issue.

Here's a link to the docs: https://nx.dev/extending-nx/project-graph-plugins

If there is part of the extension api that needs further changes, feel free to open a new feature request detailing what is missing in the current implementation.

Motivation

Would be sweet to avoid the added install latency and utilize the Nx project graph extension API

Suggested Implementation

Thanks!

jordan-boyer commented 1 year ago

I've setup a monorepo at work without nx-plus, and after some test nx seems to work without any change on .vue files

So maybe they can drop the patch entirely

leggomuhgreggo commented 1 year ago

@jordan-boyer thanks for the intel.

Your comment inspired me to investigate a little more.

Looking at the patch code, it seems like the nx logic it's modifying is still around.

Seem like that Nx code is used to register "explicit" workspace dependencies.

So I think the gap would be if you import a workspace lib from a .vue file the dep graph won't necessarily know about it -- but if you're not running into that issue, maybe those dependencies are being registered via other Nx logic?

If you're feeling curious you could test by identifying a .vue file that's importing from some project in libs/ then find that file and see what dependencies are listed.

yarn nx affected:graph --file=output.json
Example Here's an example of how I think that logic registers in the graph graph.nodes > $project > $project.files > $file.dependencies > e.g. `my-cool-workspace-lib` ![image](https://user-images.githubusercontent.com/2213636/223626659-40ac8493-74c2-47ba-87ab-46930af97c30.png)

Even if it doesn't register via the file it might be registering through other means, eg implicitDependencies cache inputs or something.

We're getting around this issue with implicitDependencies for our vue projects -- which works okay since our vue footprint is minimal -- but it's not very scalable. Hopefully as the Nx project graph plugin API matures we will be able to use it to support vue files a little more easily.