Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate selector diff report #659

Merged
merged 2 commits into from
Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ script:
- npm test
- script/check-versions

after_script:
- echo "generating selector diff report..."
- script/selector-diff-report

before_deploy:
# this will short-circuit the publish step if it fails to interpolate $NPM_API_KEY
- npm config set "//registry.npmjs.org/:_authToken=\${NPM_API_KEY}"
Expand Down
28 changes: 28 additions & 0 deletions script/selector-diff-report
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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}