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

27 lines
575 B
Bash
Executable File

#!/bin/bash
set -e
module=${1:-@primer/css}
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..."
npm run build
cp 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}