renovate-packagedata-diff
renovate-packagedata-diff
Compare Renovate package data dumps semantically
Usage
renovate-packagedata-diff before.json after.json
Examples
# to diff two files
renovate-packagedata-diff before.json after.json
# you can diff between multiple file types i.e.
# but NOTE that it's recommended to keep them the same
renovate-packagedata-diff renovate-graph-export.json log-lines.ndjson
# to use as Git's diff tool
# NOTE that this won't work for any files that aren't Renovate log files, so should be configured using `.gitattributes`
env GIT_EXTERNAL_DIFF=renovate-packagedata-diff git log -p --ext-diff
# alternatively, to set up Git to use `.gitattributes`:
echo 'renovate/*.json diff=renovate-packagedata-diff' >> .gitattributes
git config diff.renovate-packagedata-diff renovate-packagedata-diff
# then, note that you still need to use `--ext-diff`, but it'll only target Renovate data dumps
git log -p --ext-diff
Synopsis
A command-line tool to compare Renovate package data dumps semantically
Given a pair of data exports from (a mix of the below):
renovate-graph
, a wrapper around Renovate - https://gitlab.com/tanna.dev/renovate-graph/- Renovate's debug logs - https://dmd.tanna.dev/cookbooks/consuming-renovate-debug-logs/
This produces a diff view of what has semantically changed between the two, inspecting whether packages have been added/modified/removed, focussing on key metadata for understanding meaningful change between two sets of dependencies.
This is more effective than a diff than performing a standard diff between the JSON, as it disregards unhelpful metadata.
This can also be used as your diff tool for Git, for specific file paths, using the https://git-scm.com/docs/gitattributes functionality.
For instance:
# make sure that any JSON files under the `renovate` directory use `renovate-packagedata-diff`
echo 'renovate/*.json diff=renovate-packagedata-diff' >> .gitattributes
git config diff.renovate-packagedata-diff renovate-packagedata-diff
# then, note that you need to use `--ext-diff`, which will allow using the separate only target Renovate data dumps
git log -p --ext-diff
For more details, check out https://dmd.tanna.dev/renovate-packagedata-diff/
Note that the resulting Package Type is derived by renovate-packagedata-diff and will not always be correct. Please raise an issue if you encounter any Package Types that do not seem correct.
Note that right now, the following sources are unsupported:
- Renovate's Reports exports - https://dmd.tanna.dev/cookbooks/consuming-renovate-report/ - see https://gitlab.com/tanna.dev/dependency-management-data/-/issues/620
Known issues:
- Multiple versions of the same package in a given file can confuse the diffs https://gitlab.com/tanna.dev/dependency-management-data/-/issues/626
Options
Flag (type) | Usage | Notes |
---|---|---|
--debug
|
whether to enable debug logging |
|
-h, --help
|
help for renovate-packagedata-diff |
|
--output (string)
|
Whether to report in a different output format. If unset, will return console output with a table. Valid options are ["", html, json] |
|