2019-01-24 02:31:51 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
function log() {
|
|
|
|
echo "$@" 1>&2
|
|
|
|
}
|
|
|
|
|
2019-02-12 08:03:48 +03:00
|
|
|
# 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
|
2019-01-24 02:31:51 +03:00
|
|
|
|
2019-02-12 08:33:07 +03:00
|
|
|
if [[ ! -f dist/stats/primer.json ]]; then
|
|
|
|
log "Building the stats locally..."
|
|
|
|
npm run dist
|
|
|
|
fi
|
2019-02-12 08:03:48 +03:00
|
|
|
cp dist/stats/primer.json after.json
|
2019-01-24 02:31:51 +03:00
|
|
|
|
|
|
|
function list_selectors() {
|
2019-02-04 23:36:07 +03:00
|
|
|
jq -r '.cssstats.selectors.values[]' $1 | sort
|
2019-01-24 02:31:51 +03:00
|
|
|
}
|
|
|
|
|
2019-02-12 08:03:48 +03:00
|
|
|
jq -r '.cssstats.selectors.values[]' before.json > before.txt
|
|
|
|
jq -r '.selectors.values[]' after.json > after.txt
|
2019-01-24 02:31:51 +03:00
|
|
|
|
2019-02-12 08:33:07 +03:00
|
|
|
echo "[selector report] diff:"
|
2019-02-12 08:28:48 +03:00
|
|
|
(diff before.txt after.txt | tee selector-diff.log) || log "(no diff!)"
|
2019-02-12 08:33:07 +03:00
|
|
|
echo "[selector report] end"
|
|
|
|
|
2019-01-24 02:31:51 +03:00
|
|
|
rm {before,after}.{json,txt}
|