ci(aio): Add payload size limit file

This commit is contained in:
Yuan Gao 2017-06-06 21:12:51 -07:00 committed by Matias Niemelä
parent 0440251919
commit 204a2cf942
2 changed files with 12 additions and 4 deletions

8
aio/scripts/payload-limit.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
declare -A limitUncompressed
limitUncompressed=(["0"]=16000 ["inline"]=1600 ["main"]=360000 ["polyfills"]=40000 ["vendor"]=520000)
declare -A limitGzip7
limitGzip7=(["0"]=7000 ["inline"]=1000 ["main"]=60000 ["polyfills"]=13000 ["vendor"]=120000)
declare -A limitGzip9
limitGzip9=(["0"]=7000 ["inline"]=1000 ["main"]=60000 ["polyfills"]=13000 ["vendor"]=120000)

View File

@ -14,12 +14,12 @@ for filename in dist/*.bundle.js; do
payloadData="$payloadData\"uncompressed/$label\": $size, "
gzip -7 --keep -f $filename
size7=$(stat -c%s "$filename.gz")
gzip -7 $filename -c >> "${filename}7.gz"
size7=$(stat -c%s "${filename}7.gz")
payloadData="$payloadData\"gzip7/$label\": $size7, "
gzip -9 --keep -f $filename
size9=$(stat -c%s "$filename.gz")
gzip -9 $filename -c >> "${filename}9.gz"
size9=$(stat -c%s "${filename}9.gz")
payloadData="$payloadData\"gzip9/$label\": $size9, "
if [[ $size -gt ${limitUncompressed[$label]} ]]; then