question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Save dependency graph to image file

See original GitHub issue

Expected Behavior

Be able to save the dependency graph in an image file. Something like: yarn nx affected:dep-graph --saveAs="dep-graph.png"

Current Behavior

It is not possible to save the graph as an image with yarn nx dep-graph cmd

Context

The final goal would be to be able to post this image in new pull request with github actions for example

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
flo-schcommented, Aug 11, 2021

Just in case in can be useful, there are some external tools available to do that, such as capture-website (using puppeteer under the hood --> may not work on every single system though)

# First get html file
nx dep-graph --file dist/dep-graph/index.html
# Then take a screenshot of it
capture-website dist/dep-graph/index.html --output dist/dep-graph/screenshot.jpg

It comes with plenty of options to tweak the capture

 # 1- automatically overwrite last screenshot
 # 2- adding a white background
 # 3- clicking on "Select all" before taking the screenshot
 # 4- waiting for the #graph-container element (not really needed here but just to illustate)
 # 5- only capturing the #graph-container element (take out the sidebar)
 # 6- setting image height & scale (adjust those to your needs)
capture-website dist/dep-graph/index.html --output dist/dep-graph/screenshot.png\
 --overwrite\
 --style 'body { background-color: white; }'\
 --click-element 'button[data-cy="selectAllButton"]'\
 --wait-for-element '#graph-container'\
 --element '#graph-container'\
 --scale-factor 1 --height 640
2reactions
philipjfulchercommented, May 29, 2020

I’m investigating how we can implement outputting the dep graph as an image. A recent PR added the ability to output a static HTML version of the dep graph: https://github.com/nrwl/nx/pull/3049. Look for the static HTML option in our next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Saving Dependency Graphs? - FreeCAD Forum
I think it is worth a feature request, to be able to export the dependency-graph at least as png with the FreeCAD build-in...
Read more >
How to download and export Chart.js images - QuickChart
There are a handful of ways you can turn your Chart.js chart into an image and export it to a file. Use toBase64Image()...
Read more >
pydeps — pydeps 1.11.0 documentation
Python module dependency visualization. This package is primarly intended to be used from the command line through the pydeps command. Contents. pydeps.
Read more >
debtree - show relationships between packages
Dependency graphs will by default show (pre-)dependencies, recommended packages, unversioned conflicts, and virtual packages provided by the requested ...
Read more >
Dependency list - GitLab Docs
For system dependencies, this lists the image that was scanned. For application dependencies, this shows a link to the packager-specific lock file in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found