1
1
mirror of https://github.com/primer/css.git synced 2025-01-04 20:33:13 +03:00
css/script/selector-diff-report

36 lines
696 B
Bash
Executable File

#!/bin/bash
set -e
function log() {
echo "$@" 1>&2
}
pkg="@primer/css"
path="dist/stats/primer.json"
log "Pulling the old $path from unpkg.com..."
curl -sL "https://unpkg.com/$pkg/$path" > before.json
if [[ ! -f $path ]]; then
log "Building the stats locally..."
npm run dist
fi
cp $path after.json
function list_selectors() {
jq -r '.cssstats.selectors.values[]' $1 | sort
}
key=".selectors.values[]"
jq -r $key before.json > before.txt
jq -r $key after.json > after.txt
function warn() {
echo "$@" 1>&2
}
warn "[selector report] diff:"
(diff before.txt after.txt | tee selector-diff.log) || log "(no diff!)"
warn "[selector report] end"
rm {before,after}.{json,txt}