Is there a way to build …

2 minute read

Is there a way to build a static version of the dep-graph that I could deploy? or a node server if needed, basically is there an obvious way to deploy this somewhere? I noticed I can generate a json output but not sure what I can do with that – if I could generate a dep-graph of only affected packages in a pull request and deploy it, that would be the optimal solution for our QA team to have a clearer image of what exactly needs to be tested.


I would look at how the affected dep grpah command is serving the dep graph (it serves it on a local port for you to view) then launch a web server the same way behind authentication.

Not sure how they are serving it though.

Yeah I tried diving into the nrwl/nx repo, but if I’m not mistaken it’s a custom solution – there’s an startServer function that well, starts the server generating some html

it seems to effectively serve this folder from workspace core

but here in project-graph, seems to be where they get the contents of dist/nxdeps.json

which is why I started wondering, wouldn’t it be useful if nx could either output a static folder or a node server that I could deploy from dist and serve somewhere?j

try and find the package that is being used to parse the dep graph.

I’m started to doubt there is one, it looks a little like it’s all a part of the workspace/core package


You can output the dependency graph to a json file. <>

There is also print-affected

Thanks , but what if I’d like to render the website I get when running the dep-graph script and deploy it as its own website? Is there a way to parse the json into that UI without using the nx script?

Dream case scenario would be if the dep-graph commands could output the contents of workspace/src/core/dep-graph folder with the projects+affected data already injected (< as is done for the server within nx>). That way I could just deply/serve that folder however I want to.

My main use case would be as part of running tests and deploying my app for each PR, I could deploy a small site displaying the dependency graph of affected packages in that PR. QA could then just click that link and see what packages need to be tested.

I’m inclined to think it would be relatively easy to implement, we would just need to move that snippet of code that injects the json into the html file to it’s own function, and then optionally instead of starting the server we could copy the whole core/dep-graph folder to the dist folder and use that injection function to get the data.

if you could confirm that I’m on the right track with this I could flesh this out in an issue/feature request and possibly attempt to make a pr to implement it?

It’s worth opening a issue for discussion at least

Ok thanks, I’ll do that and we’ll see from there :slightly_smiling_face:

I’ve created, and an attempt to implement the solution in this PR

Just saw that the PR had merged. Nice work !

Thanks , love being able to contribute :slightly_smiling_face: