From a995af67097df3bebe9ba191bfdfaa605e8f56a0 Mon Sep 17 00:00:00 2001 From: Sophia Mersmann Date: Thu, 9 Jan 2025 11:13:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9D=20(svg=20tester)=20format=20refere?= =?UTF-8?q?nce=20svgs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- devTools/svgTester/update-configs.sh | 52 ++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/devTools/svgTester/update-configs.sh b/devTools/svgTester/update-configs.sh index 6604fc59dc4..2bc3cd3c5f4 100755 --- a/devTools/svgTester/update-configs.sh +++ b/devTools/svgTester/update-configs.sh @@ -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