Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewmcodes/5c932b04d0ae45ca9cff6498cec2a568 to your computer and use it in GitHub Desktop.
Save andrewmcodes/5c932b04d0ae45ca9cff6498cec2a568 to your computer and use it in GitHub Desktop.
Script to generate a Markdown table from `yarn licenses list`
#!/bin/sh
# Output a dependencies.md file with a table of installed Yarn dependencies
# Requires csvkit, jq
# https://csvkit.readthedocs.io/en/0.9.1/install.html
# https://stedolan.github.io/jq/download/
yarn licenses list --json \
| jq --slurp 'map(select(.type == "table"))' \
| jq -c [.[0].data.head],.[0].data.body \
| sed -E 's/\],\[/\n/g' \
| csvlook \
| sed -E 's/(\[|\]|")+/ /g' > dependencies.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment