used-deps-analyzer
v0.1.8
Published
Analyse js code to force match between installed & used deps
Downloads
42
Readme
used-deps-analyzer
Analyse js code to force match between installed & used deps
Installation
$ npm install used-deps-analyzer
Features
- Analyse a directory content to find unused installed deps
- Analyse a directory content to find used uninstalled deps
Doc
Content
check the TypeScript definition file
Examples
check the TypeScript compilation tests
Options
- noDev | --no-dev : do not use dev deps for comparaison (used files, don't use it to analyze test or build scripts)
- onlyDev | --only-dev : use only dev deps for comparaison (test or build scripts, don't use it to analyze used files)
- overkill | --overkill : list of deps which should not be used but can be still present for unknown reasons (do not fail, trigger only warnings)
- misscalled | --misscalled Array : list of deps which are not called by this name in the code
- shadows | --shadows Array : list of deps which are used in the code but not required (to force a sub-dep version for example)
interface iSubModule {
"module": string;
"call": string;
}
Run
cd ./myProject/ && npx used-deps-analyzer -- "./package.json" "./dir" --no-dev
const usedDepsAnalyzer = require("used-deps-analyzer");
usedDepsAnalyzer("./package.json", "./src", {
"noDev": true,
"overkill": [
"node-promfs"
],
"misscalled": [
{
"module": "colors",
"call": "colors/safe"
}
],
"shadows": [
"newer-version",
"not-called-front-lib"
]
}).then((analyze) => {
if (analyze.warnings) {
analyze.warnings.forEach((a) => {
console.warn(a);
});
}
if (analyze.result) {
console.log("all ok");
}
else {
analyze.errors.forEach((a) => {
console.error(a);
});
}
}).catch((err) => {
console.log(err);
});
Tests
$ npm run-script tests