1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 01:04:04 +03:00
css/script/selector-diff-report

30 lines
582 B
Plaintext
Raw Normal View History

2019-01-24 02:31:51 +03:00
#!/bin/bash
set -e
function log() {
2019-04-26 23:11:08 +03:00
echo "$@" 1>&2
2019-01-24 02:31:51 +03:00
}
function warn() {
2019-04-26 23:11:08 +03:00
echo "$@" 1>&2
}
pkg="@primer/css"
path="dist/stats/primer.json"
warn "Pulling the old $path from unpkg.com..."
curl -sL "https://unpkg.com/$pkg/$path" > before.json
2019-01-24 02:31:51 +03:00
warn "Building the stats locally..."
npm run --silent dist
cp $path after.json
2019-01-24 02:31:51 +03:00
key=".selectors.values[]"
jq -r $key before.json > before.txt
jq -r $key after.json > after.txt
2019-01-24 02:31:51 +03:00
warn "[selector report] diff:"
2019-04-26 23:11:08 +03:00
(diff {before,after}.txt | tee selector-diff.log) || log "(no diff!)"
warn "[selector report] end"
2019-01-24 02:31:51 +03:00
rm {before,after}.{json,txt}