diff --git a/dev-scripts/.htaccess b/dev-scripts/.htaccess new file mode 100644 index 000000000..14249c50b --- /dev/null +++ b/dev-scripts/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/dev-scripts/svg_check.sh b/dev-scripts/svg_check.sh new file mode 100644 index 000000000..bd31cd9de --- /dev/null +++ b/dev-scripts/svg_check.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +found=0 +for svgfile in `find resources -type f -name "*.svg"`; do + outfile="$svgfile.tmp" + node_modules/.bin/svgo --config .svgo.config.js -i $svgfile -o $outfile -q + if [ $(wc -c $svgfile | awk '{print $1}') -gt $(wc -c $outfile | awk '{print $1}') ]; then + echo "File $svgfile is not compressed" + found=$((found + 1)) + fi + rm $outfile +done +if [ $found -gt 0 ]; then + echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch" + exit 1 +fi \ No newline at end of file diff --git a/package.json b/package.json index 672af2d59..ef3bcae1a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build-storybook": "./.storybook/storybook-resources.sh && build-storybook --config-dir=.storybook -o docs/ui -s .storybook/static", "start": "webpack -w --mode=development", "build": "webpack --mode=production", - "test": "npm -s run check-built-assets && npm run test:lint && npm -s run coverage && npm -s run -s doc && bundlesize && npm run build-storybook", + "test": "npm -s run check-built-assets && npm run test:lint && bash ./dev-scripts/svg_check.sh && npm -s run coverage && npm -s run -s doc && bundlesize && npm run build-storybook", "test:unit": "mw-node-qunit 'tests/node-qunit/**/*.test.js' --require \"$PWD/tests/node-qunit/run.js\" | tap-mocha-reporter dot", "test:lint": "npm -s run test:lint:styles && npm -s run test:lint:js && npm -s run test:lint:i18n", "test:lint:js": "npm -s run linter:js",