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

🐝 (svg tester) prettify svgs for easier comparison #4418

Merged
merged 1 commit into from
Jan 9, 2025
Merged
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
52 changes: 37 additions & 15 deletions devTools/svgTester/update-configs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,51 @@ Make sure to run \`make refresh\` and \`make refresh.pageviews\` before running

main() {
echo "=> Resetting owid-grapher-svgs to origin/master"
cd $SVGS_REPO\
&& git fetch\
&& git checkout -f master\
&& git reset --hard origin/master\
&& git clean -fd\
cd $SVGS_REPO \
&& git fetch \
&& git checkout -f master \
&& git reset --hard origin/master \
&& git clean -fdx \
&& cd -

echo "=> Removing existing configs and reference svgs"
rm -rf $CONFIGS_DIR $REFERENCES_DIR $ALL_VIEWS_DIR

echo "=> Dumping new configs and data"
rm -rf $CONFIGS_DIR
node itsJustJavascript/devTools/svgTester/dump-data.js -o $CONFIGS_DIR
node itsJustJavascript/devTools/svgTester/dump-chart-ids.js -o $CHART_IDS_FILE

echo "=> Generating reference SVGs"
node itsJustJavascript/devTools/svgTester/export-graphs.js\
-i $CONFIGS_DIR\
echo "=> Committing new configs and chart ids"
cd $SVGS_REPO \
&& git add --all \
&& git commit -m "chore: update configs and chart ids" \
&& cd -

echo "=> Generating reference SVGs (default views)"
rm -rf $REFERENCES_DIR
node itsJustJavascript/devTools/svgTester/export-graphs.js \
-i $CONFIGS_DIR \
-o $REFERENCES_DIR
node itsJustJavascript/devTools/svgTester/export-graphs.js\
-i $CONFIGS_DIR\
-o $ALL_VIEWS_SVG_DIR\
-f $CHART_IDS_FILE\
yarn prettier --write --parser html $REFERENCES_DIR

echo "=> Committing reference SVGs (default views)"
cd $SVGS_REPO \
&& git add --all \
&& git commit -m 'chore: update reference svgs (default views)' \
&& cd -

echo "=> Generating reference SVGs (all views)"
rm -rf $ALL_VIEWS_DIR
node itsJustJavascript/devTools/svgTester/export-graphs.js \
-i $CONFIGS_DIR \
-o $ALL_VIEWS_SVG_DIR \
-f $CHART_IDS_FILE \
--all-views
yarn prettier --write --parser html $ALL_VIEWS_SVG_DIR

echo "=> Committing reference SVGs (all views)"
cd $SVGS_REPO \
&& git add --all \
&& git commit -m 'chore: update reference svgs (all views)' \
&& cd -
}

# show help
Expand Down
Loading