Skip to content

Instantly share code, notes, and snippets.

@jrybinski
Created April 9, 2020 08:59
Show Gist options
  • Save jrybinski/3d27cddee875b7d152c5e8eec86d14f3 to your computer and use it in GitHub Desktop.
Save jrybinski/3d27cddee875b7d152c5e8eec86d14f3 to your computer and use it in GitHub Desktop.
Print out details of angular project. Used for comparing bundle size with project details.
getFilesOfType() {
find . -name "$1" -not -path "./node_modules/*" -not -path "./dist/*" -not -path "./reports/*"
}
getEs5JSBuildFiles() {
du -chk ./dist/*es5*.js | grep total
}
getEs2015JSBuildFiles() {
du -chk ./dist/*es2015*.js | grep total
}
TypescriptFiles=$(getFilesOfType "*.ts")
SCSSFiles=$(getFilesOfType "*.scss")
CSSFiles=$(getFilesOfType "*.css")
HTMLFiles=$(getFilesOfType "*.html")
echo "Typescript files $(echo $TypescriptFiles | wc -l)"
echo "SCSSFiles files $(echo $SCSSFiles | wc -l)"
echo "CSSFiles files $(echo $CSSFiles | wc -l)"
echo "HTMLFiles files $(echo $HTMLFiles | wc -l)"
echo "Modules $(echo $TypescriptFiles | egrep -c ".module.ts$")"
echo "Components $(echo $TypescriptFiles | egrep -c ".component.ts$")"
echo "Pipes $(echo $TypescriptFiles | egrep -c ".pipe.ts$")"
echo "Directives $(echo $TypescriptFiles | egrep -c ".directive.ts$")"
echo "Services $(echo $TypescriptFiles | egrep -c ".service.ts$")"
echo "Tests $(echo $TypescriptFiles | egrep -c ".spec.ts$")"
echo "JS Bundle[kB] es5 size $(echo $(getEs5JSBuildFiles))"
echo "JS Bundle[kB] es2015 size $(echo $(getEs2015JSBuildFiles))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment