mirror of
https://github.com/primer/css.git
synced 2024-12-01 20:53:06 +03:00
31 lines
727 B
Bash
Executable File
31 lines
727 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
function log() {
|
|
echo "$@" 1>&2
|
|
}
|
|
|
|
# TODO: update this to pull from @primer/css
|
|
old_path="primer/build/data.json"
|
|
log "Pulling the old $old_path ..."
|
|
curl -sL "https://unpkg.com/$old_path" > before.json
|
|
|
|
if [[ ! -f dist/stats/primer.json ]]; then
|
|
log "Building the stats locally..."
|
|
npm run dist
|
|
fi
|
|
cp dist/stats/primer.json after.json
|
|
|
|
function list_selectors() {
|
|
jq -r '.cssstats.selectors.values[]' $1 | sort
|
|
}
|
|
|
|
jq -r '.cssstats.selectors.values[]' before.json > before.txt
|
|
jq -r '.selectors.values[]' after.json > after.txt
|
|
|
|
echo "[selector report] diff:"
|
|
(diff before.txt after.txt | tee selector-diff.log) || log "(no diff!)"
|
|
echo "[selector report] end"
|
|
|
|
rm {before,after}.{json,txt}
|