util to detect undeclared deps and phantom deps
- CLI
npx scan-deps
Usage: scan-deps [options]
Options:
-V, --version output the version number
--json output as json
--debug turn on debug log
--all output all dependencies includes detected
dependencies
--directory directory included, default: src,lib
--extension included file extensions, default:
ts,js,tsx,jsx
-h, --help display help for command
- Node API
import { scanDeps } from "scan-deps";
async function main() {
const { detectedDependencies, missingDependencies, unusedDependencies } =
await scanDeps({
// cwd: process.cwd(),
// directory: 'src,lib',
// extension: 'ts,js,tsx,jsx',
});
}
yarn install
yarn build:watch
MIT @chengcyber