我正在尝试从几个项目的 package.json 文件中删除未使用的包,但我遇到了对等依赖项的问题。有一些工具,例如depcheck
,会尝试列出所有“未使用”的包,但它不会区分实际未使用的包和未使用的包,因为它们是对等依赖项。
是否有一个包,或者一些npm
我不熟悉的命令,这将允许我列出我的项目中的所有对等依赖项,或者至少允许我输入一个包名并查看该包是否安装是因为它是另一个包的对等依赖项?
对于后代,这是我的一个项目的依赖项的示例。例如,在这个项目中,我知道这reflect-metadata
是一个对等依赖项@nestjs/common
,但我只是在卸载它之后才发现。
"dependencies": {
"@google-cloud/storage": "^3.2.1",
"@google-cloud/vision": "^1.3.0",
"@google/maps": "^0.5.5",
"@nestjs/common": "^6.6.7",
"@nestjs/core": "^6.6.7",
"@nestjs/platform-express": "^6.6.7",
"@slack/webhook": "^5.0.1",
"@typeform/api-client": "^1.5.1",
"algoliasearch": "^3.34.0",
"array-uniq": "^2.1.0",
"basic-auth": "^2.0.1",
"child-process-promise": "^2.2.1",
"class-transformer": "^0.2.3",
"class-validator": "^0.10.0",
"express": "^4.17.1",
"firebase-admin": "^8.5.0",
"firebase-functions": "^3.2.0",
"geoip-lite": "^1.3.8",
"geolib": "^3.0.4",
"glob": "^7.1.4",
"hbs": "^4.0.4",
"hubspot-api": "^2.2.10",
"json2csv": "^4.5.3",
"lodash": "^4.17.15",
"luxon": "^1.17.2",
"node-fetch": "^2.6.0",
"postmark": "^2.2.9",
"promise-settle": "^0.3.0",
"qrcode": "^1.4.1",
"redux": "^4.0.4",
"reflect-metadata": "^0.1.13",
"rxjs": "^6.5.3",
"sales-tax": "^2.0.10",
"sanitize-filename": "^1.6.3",
"sharp": "^0.23.0",
"stripe": "^7.9.0"
},