mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-27 08:50:33 +00:00
build: Enforce check for uncompressed SVG files in CI
- 'dev-scripts/svg_check.sh' is added to the Popups repo - `svg_check` is run during the npm test script Bug: T280923 Change-Id: I02715a5a70f0effb3625694f0afb3cd6250ef46c
This commit is contained in:
parent
c3dc5f8e05
commit
4f12a23794
1
dev-scripts/.htaccess
Normal file
1
dev-scripts/.htaccess
Normal file
|
@ -0,0 +1 @@
|
|||
Deny from all
|
15
dev-scripts/svg_check.sh
Normal file
15
dev-scripts/svg_check.sh
Normal 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
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue