I recently updated some dependencies in a node project and some things broke. I wanted to get a list of every dependency (and dependencies of dependencies) that changed, so I came up with this little one-liner.
You'll see that I'm passing two "files" into diff via I/O redirection. I'm using git to retrieve the two files - the commit that updated the dependencies had a git hash of 735e8cd3c. So, the first file is 735e8cd3c^:package-lock.json (notice the caret - that means the parent commit of 735e8cd3c - ie, the version before I updated dependencies). The second file is 735e8cd3c:package-lock.json (no caret - ie, the version where I updated dependencies).
I then pipe each file into jq (jq '.dependencies | map_values(.version)') to extract the name and version of every package my project depends on (that includes dependencies of dependencies).
Finally, diff will tell me what changed.
diff <(git show 735e8cd3c^:package-lock.json | jq '.dependencies | map_values(.version)') <(git show 735e8cd3c:package-lock.json | jq '.dependencies | map_values(.version)')
 

 
    
Top comments (0)