Skip to content

Instantly share code, notes, and snippets.

@vezaynk
Created September 29, 2022 16:55
Show Gist options
  • Save vezaynk/4e56764d79f3c60d74b74b68c73f7d8a to your computer and use it in GitHub Desktop.
Save vezaynk/4e56764d79f3c60d74b74b68c73f7d8a to your computer and use it in GitHub Desktop.
TypeScript adoption over time
#!/bin/bash
# Generate TypeScript adoption data
# Google Docs Spreadsheet:
# https://docs.google.com/spreadsheets/d/13iDFWEhGbE8ZGu1LoXmRINy1ZSLd227mAFj99Evl6fc
# Usage:
# bash ./stats.sh > results.tsv
# Copy paste data into sheet
DATE="2022-07-01" # Tune this file to set start date of adoption
COMMITS_WITH_TIMESTAMP=`git log --pretty='format:%H-%ct' --after="$DATE"`
T=$(printf "\t")
echo "TIMESTAMP $T JSX $T JS $T TSX $T TS"
for c in $COMMITS_WITH_TIMESTAMP
do
COMMIT=$(echo $c | cut -d "-" -f 1)
TIMESTAMP=$(echo $c | cut -d "-" -f 2)
git checkout $COMMIT > /dev/null
JSX=$(find src/* -name "*.jsx" | xargs cat | wc -l)
JS=$(find src/* -name "*.js" | xargs cat | wc -l)
TSX=$(find src/* -name "*.tsx" | xargs cat | wc -l)
TS=$(find src/* -name "*.ts" | xargs cat | wc -l)
echo "$TIMESTAMP $T $JSX $T $JS $T $TSX $T $TS"
done
git checkout mainline > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment