-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
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,15 @@ | ||
#!/bin/bash | ||
|
||
DIR=$(dirname "$0") | ||
|
||
# CSV header corresponding to lines in the metrics | ||
echo "Commit,Version,Date,TS,JS,TS%,lib,test,Dependencies,window,Directives,Components" | ||
|
||
# Check out each tagged version and run metrics | ||
# Skip v6.x, it had lots of dependencies checked in | ||
for TAG in $(git tag | grep -v 'v6'); do | ||
git checkout -q "$TAG" | ||
DATE=$(git show --no-patch --format=%cs) | ||
# Output as CSV rows | ||
"$DIR"/fe-stats-get.sh -q | paste -sd , - | ||
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,54 @@ | ||
#!/bin/bash | ||
|
||
# Add `-q` to skip labels | ||
while getopts "q" flag; do | ||
case $flag in | ||
q) OPT_QUIET=1 ;; | ||
esac | ||
done | ||
|
||
function label() { | ||
# Say label unless -q was given | ||
[ -z $OPT_QUIET ] && echo -ne "$1:\t" | ||
# Say value if present | ||
[ -n "$2" ] && echo $2 | ||
} | ||
|
||
WC_JS=$(find app -type f -name '*.js' | xargs wc -l --total=only) | ||
WC_TS=$(find app -type f -name '*.ts' | xargs wc -l --total=only) | ||
TS_RATIO=$(node -pe "Math.round($WC_TS / ($WC_TS + $WC_JS) * 100)") | ||
|
||
# TODO The git commands output control chars, and they bork the label strings | ||
label "Commit hash" | ||
git show --no-patch --format="%h" | ||
|
||
label "Tag" | ||
git tag --points-at HEAD | grep "^v" | ||
|
||
label "Date" | ||
git show --no-patch --format=%cs | ||
|
||
label "TypeScript lines of code" $WC_TS | ||
label "JavaScript lines of code" $WC_JS | ||
label "Ratio of TypeScript" $TS_RATIO% | ||
|
||
label "Size of repo (KB)" | ||
git ls-files | xargs du --apparent-size -c | tail -n1 | cut -f1 | ||
|
||
label "Size of lib/ (KB)" | ||
du --apparent-size -s app/lib/ | cut -f1 | ||
|
||
label "Test lines of code" | ||
find test/ -type f | xargs wc -l --total=only | ||
|
||
label "Direct dependencies" | ||
cat package.json | jq '.dependencies * .devDependencies | keys | length' | ||
|
||
label "Assignments to \`window\`" | ||
grep -roE 'window\.\w+ =' app/scripts/ | grep -v window.location | wc -l | ||
|
||
label "AngularJS directives" | ||
grep -r .directive\( app/scripts/ | wc -l | ||
|
||
label "AngularJS components" | ||
grep -r .component\( app/scripts/ | wc -l |