-
-
Save brentvatne/6390909075b02811ef5384d5b7c41ab2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assumes you have ag installed, `brew install the_silver_searcher` | |
const fs = require('fs'); | |
const packageJson = fs.readFileSync('./package.json'); | |
const dependencies = Object.keys(JSON.parse(packageJson).dependencies); | |
const { execSync } = require('child_process'); | |
dependencies.forEach(dep => { | |
try { | |
let result = execSync(`ag '${dep}' --ignore node_modules --ignore package.json --ignore yarn.lock --ignore package-lock.json`); | |
} catch(e) { | |
console.log(`${dep} is unused`); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome, thanks! Ripgrep is even faster than
ag
, also available w/ brew!