-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐝 (svg tester) add helper script to update SVGs (#3859)
- Loading branch information
1 parent
9013bf3
commit bc9ba63
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit # exit script when a command fails | ||
set -o nounset # fail when accessing an unset variable | ||
set -o pipefail # treats pipeline command as failed when one command in the pipeline fails | ||
|
||
SVGS_REPO=../owid-grapher-svgs | ||
CONFIGS_DIR=$SVGS_REPO/configs | ||
REFERENCES_DIR=$SVGS_REPO/svg | ||
ALL_VIEWS_DIR=$SVGS_REPO/all-views/svg | ||
CHART_IDS_FILE=$SVGS_REPO/most-viewed-charts.txt | ||
|
||
usage() { | ||
echo -e "Usage: ./$(basename "$0") [-h | --help] | ||
Dump a new set of configs and generate reference SVGs. | ||
Make sure to run \`make refresh\` and \`make refresh.pageviews\` before running this script." | ||
} | ||
|
||
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 - | ||
|
||
echo "=> Removing existing configs and reference svgs" | ||
rm -rf $CONFIGS_DIR $REFERENCES_DIR $ALL_VIEWS_DIR | ||
|
||
echo "=> Dumping new configs and data" | ||
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\ | ||
-o $REFERENCES_DIR | ||
node itsJustJavascript/devTools/svgTester/export-graphs.js\ | ||
-i $CONFIGS_DIR\ | ||
-o $ALL_VIEWS_DIR\ | ||
-f $CHART_IDS_FILE\ | ||
--all-views | ||
} | ||
|
||
# show help | ||
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then | ||
usage | ||
exit | ||
fi | ||
|
||
main |