Skip to content

Instantly share code, notes, and snippets.

@qwertypants
Created December 15, 2022 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qwertypants/50bae6c0c2e3c4eddaf2eeb97568c8dc to your computer and use it in GitHub Desktop.
Save qwertypants/50bae6c0c2e3c4eddaf2eeb97568c8dc to your computer and use it in GitHub Desktop.
const glob = require('glob');
const jsFiles = glob.sync('src/**/*.js');
const tsFiles = glob.sync('src/**/*.ts');
const tsxFiles = glob.sync('src/**/*.tsx');
const allTsFiles = tsFiles.concat(tsxFiles);
console.log(`There are ${jsFiles.length} .js files in the 'src' directory.`);
console.log(`There are ${allTsFiles.length} .ts/x files in the 'src' directory.`);
console.log(`${Math.round((allTsFiles.length / jsFiles.length) * 100)}% of the files are TypeScript files.`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment