Skip to content

Instantly share code, notes, and snippets.

@klaytonfaria
Last active June 2, 2020 10:34
Show Gist options
  • Save klaytonfaria/a4e17f6c2e5d1e0f7c4f77dccb54eac6 to your computer and use it in GitHub Desktop.
Save klaytonfaria/a4e17f6c2e5d1e0f7c4f77dccb54eac6 to your computer and use it in GitHub Desktop.

Script to track % of TypeScript in your repo / project

If you are migrating to TypeScript it may be nice to keep track of how you are doing for a particular project, here is an example of using Tokei and jq to do this.

You can install both via Homebrew

  • brew install jq
  • brew install tokei

Run this in the root of your project.

Use -e to exlude any files you don't want to count

tokei -e styles.js -o json | jq '100 * .inner.TypeScript.code / (.inner.JavaScript.code + .inner.TypeScript.code)'

Credits to https://github.com/lili2311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment