-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sizes utility from Timezone. Display minified size during tests so that they show up in Travis CI output. Closes #22. Closes #21.
- Loading branch information
1 parent
907dce6
commit 9c1806e
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
declare -A b | ||
declare -A k | ||
|
||
printf " %-24s %11s %11s %11s %11s\n" File Raw Min Zip Min/Zip | ||
for file in $@; do | ||
b[raw]=$(cat $file | wc -c) | ||
b[min]=$(cat $file | uglifyjs | wc -c) | ||
alt=$(cat $file | uglifyjs --lift-vars | wc -c) | ||
if [ $alt -lt ${b[min]} ]; then | ||
b[min]=$alt | ||
fi | ||
b[zip]=$(cat $file | gzip -c | wc -c) | ||
b[minzip]=$(cat $file | uglifyjs | gzip -c | wc -c) | ||
alt=$(cat $file | uglifyjs --lift-vars | gzip -c | wc -c) | ||
if [ $alt -lt ${b[minzip]} ]; then | ||
b[minzip]=$alt | ||
fi | ||
for field in raw min zip minzip; do | ||
k[$field]=$(echo "${b[$field]} / 1024" | bc -l) | ||
done | ||
printf " %-24s" $file | ||
for field in raw min zip minzip; do | ||
printf "%6d/%05.2f" ${b[$field]} ${k[$field]} | ||
done | ||
printf "\n" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if [ "$TRAVIS" = "true" ]; then | ||
sudo apt-get install -q -q bc 2> /dev/null > /dev/null && echo 'Installed `bc`.' && echo '' | ||
fi | ||
|
||
build/sizes index.js | ||
|
||
echo "" | ||
|
||
(proof run t/*/*.t | tee .proof.out | proof progress) || (proof errors < .proof.out) || exit 1 | ||
|
||
if [ "$TRAVIS" = "true" ] || [ "$MINIFY" = "true" ]; then | ||
echo "" | ||
echo "minified" | ||
echo "" | ||
default=$(cat index.js | uglifyjs | gzip -c | wc -c) | ||
lift=$(cat index.js | uglifyjs --lift-vars | gzip -c | wc -c) | ||
|
||
bak=index-$(date +'%FT%T').js | ||
mv index.js $bak | ||
if [ $default -lt $lift ]; then | ||
cat $bak | uglifyjs > index.js | ||
else | ||
cat $bak | uglifyjs --lift-vars > index.js | ||
fi | ||
|
||
(proof run t/*/*.t | tee .proof.out | proof progress) || (proof errors < .proof.out) || exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters