#!/bin/bash set -e function log() { echo "$@" 1>&2 } function warn() { echo "$@" 1>&2 } pkg="@primer/css" path="dist/stats/primer.json" warn "Pulling the old $path from unpkg.com..." curl -sL "https://unpkg.com/$pkg/$path" > before.json warn "Building the stats locally..." npm run dist 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 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}