Created
April 26, 2019 15:32
-
-
Save jrgleason/07b867ba77d9766b87c6946a158bec56 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
import depcheck from 'depcheck'; | |
import path from "path"; | |
const options = { | |
withoutDev: false, // [DEPRECATED] check against devDependencies | |
ignoreBinPackage: false, // ignore the packages with bin entry | |
skipMissing: false, // skip calculation of missing dependencies | |
ignoreDirs: [ // folder with these names will be ignored | |
'dist' | |
], | |
parsers: { // the target parsers | |
'*.js': depcheck.parser.es6 | |
}, | |
detectors: [ // the target detectors | |
depcheck.detector.requireCallExpression, | |
depcheck.detector.importDeclaration | |
], | |
specials: [ // the target special parsers | |
depcheck.special.eslint | |
] | |
}; | |
depcheck(path.join(path.resolve(), "./"),options, (unused) => { | |
console.log(`Unused ${unused.dependencies}`); // an array containing the unused dependencies | |
console.log(`Unused dev ${unused.devDependencies}`); // an array containing the unused devDependencies | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment