From 0600e1eb305292fe84d07b527786359d73089d29 Mon Sep 17 00:00:00 2001 From: Cynthia Lin Date: Mon, 22 May 2017 15:11:08 -0700 Subject: [PATCH] tools: Add optimize-svg tool for checking for unoptimized SVG files. --- tools/optimize-svg | 10 ++++++++++ tools/test-all | 1 + tools/travis/backend | 1 + 3 files changed, 12 insertions(+) create mode 100755 tools/optimize-svg diff --git a/tools/optimize-svg b/tools/optimize-svg new file mode 100755 index 0000000000..1450eddc23 --- /dev/null +++ b/tools/optimize-svg @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ `node_modules/.bin/svgo -f static/images/integrations/logos | grep -o '\.[0-9]% = ' | wc -l` -ge 1 ] + then + echo "ERROR: svgo detected unoptimized SVG files in the \`static/images/integrations/logos\` folder." 1>&2 + echo "Please run \`svgo -f static/images/integrations/logos\` and commit the file changes to optimize them." + exit 1 + else + echo "SUCCESS: SVG files in static/images/integrations/logos are all optimized!" +fi diff --git a/tools/test-all b/tools/test-all index ea839a19c8..de273addbf 100755 --- a/tools/test-all +++ b/tools/test-all @@ -39,6 +39,7 @@ run ./tools/test-js-with-node run ./tools/run-mypy run ./tools/test-backend $FORCEARG run ./tools/test-js-with-casper $FORCEARG +run ./tools/optimize-svg # Not running queue worker reload tests since it's low-churn code # run ./tools/test-queue-worker-reload # Not running documentation tests since it takes 20s and only tests documentation diff --git a/tools/travis/backend b/tools/travis/backend index 1ea98d8fa4..92b4038777 100755 --- a/tools/travis/backend +++ b/tools/travis/backend @@ -11,6 +11,7 @@ set -x ./tools/test-migrations # test-run-dev temporarily disabled due to weird Travis CI issues. #./tools/test-run-dev +./tools/optimize-svg ./tools/test-documentation ./tools/test-help-documentation.py ./tools/test-api