Skip to content

Instantly share code, notes, and snippets.

@Timothee
Created May 6, 2020 23:01
Show Gist options
  • Save Timothee/af437b9f4486f2f03da447de29b6e69d to your computer and use it in GitHub Desktop.
Save Timothee/af437b9f4486f2f03da447de29b6e69d to your computer and use it in GitHub Desktop.
CoffeeScript to JavaScript conversion stats

I wrote this to get some stats on the conversion from CoffeeScript to JavaScript. It's not interesting enough to frame on the wall, but I want to clean up my local git repo but want to have a tiny chance of finding it again if I ever need to. :) This runs through a bunch of commits and puts some stats about it in a couple of files.

I used these files with an online tool to display the evolution over time

#!/bin/sh
lastcount=20000000
CJSX_FILE=cjsx.csv
JSX_FILE=jsx.csv
COMBINED=combined.csv
echo "" > $CJSX_FILE
echo "" > $JSX_FILE
echo "" > $COMBINED
for commit in $(git rev-list --merges --reverse -n 10000 master)
do
# echo $commit
date=$(git log -n1 $commit --format="%aI")
author=$(git log -n1 $commit --format="%ae")
jsx_count=$(git ls-tree -r $commit | grep -c "\.jsx$")
cjsx_count=$(git ls-tree -r $commit | grep -c "\.cjsx$")
count=$(git ls-tree -r --name-only $commit | grep -c "\.cjsx$")
# echo $count
if [ $lastcount -ne $count ]; then
lastcount=$count
author=$(git log $commit -n 1 --format="%ae")
echo "$date,$lastcount" >> $CJSX_FILE
echo "$date,$jsx_count" >> $JSX_FILE
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment