Merge "build: Enforce check for uncompressed SVG files in CI"

This commit is contained in:
jenkins-bot 2021-04-28 21:47:30 +00:00 committed by Gerrit Code Review
commit 121c0093b9
3 changed files with 17 additions and 1 deletions

1
dev-scripts/.htaccess Normal file
View file

@ -0,0 +1 @@
Deny from all

15
dev-scripts/svg_check.sh Normal file
View file

@ -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

View file

@ -5,7 +5,7 @@
"build-storybook": "./.storybook/storybook-resources.sh && build-storybook --config-dir=.storybook -o docs/ui -s .storybook/static", "build-storybook": "./.storybook/storybook-resources.sh && build-storybook --config-dir=.storybook -o docs/ui -s .storybook/static",
"start": "webpack -w --mode=development", "start": "webpack -w --mode=development",
"build": "webpack --mode=production", "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: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": "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", "test:lint:js": "npm -s run linter:js",