1
1
mirror of https://github.com/primer/css.git synced 2024-12-01 20:53:06 +03:00
css/script/selector-diff-report
2019-01-23 15:31:51 -08:00

29 lines
639 B
Bash
Executable File

#!/bin/bash
set -e
module=${1:-primer}
version=${2:-latest}
function log() {
echo "$@" 1>&2
}
log "Pulling the latest ${module}/build/data.json ..."
curl -sL "https://unpkg.com/${module}@${version}/build/data.json" > before.json
log "Building ${module}/build/data.json locally..."
pushd modules/${module} > /dev/null
npm run build
popd > /dev/null
cp modules/${module}/build/data.json after.json
function list_selectors() {
jq -r .cssstats.selectors.values[] $1 | sort
}
list_selectors before.json > before.txt
list_selectors after.json > after.txt
diff before.txt after.txt && log "(no diff!)"
rm {before,after}.{json,txt}