Jon*_*der 5 node.js npm node-modules
我知道我可以通过获取我的直接依赖项列表
npm ls --depth=0 --only=production
产生这样的东西
my-app@1.1.0 /code/my-app
??? autosize@4.0.1
??? bluebird@3.5.1
??? blueimp-md5@2.10.0
??? buefy@0.6.5
??? bulma@0.6.2
??? bulma-badge@1.0.1
??? bulma-switch@0.1.12
??? d3-scale-chromatic@1.2.0
??? date-fns@1.29.0
... etc ...
Run Code Online (Sandbox Code Playgroud)
是否有一种简单的方法来使输出看起来像这样?
my-app@1.1.0 /code/my-app
??? autosize@4.0.1 (4 dependencies)
??? bluebird@3.5.1 (28 dependencies)
??? blueimp-md5@2.10.0 (12 dependencies)
??? buefy@0.6.5 (30 dependencies)
??? bulma@0.6.2 (21 dependencies)
??? bulma-badge@1.0.1 (3 dependencies)
??? bulma-switch@0.1.12 (93 dependencies)
??? d3-scale-chromatic@1.2.0 (1 dependency)
??? date-fns@1.29.0 (7 dependencies)
Run Code Online (Sandbox Code Playgroud)
我不\xe2\x80\x99t 认为 npm 本身就提供了这个。shell脚本可以做类似的事情:
\nfor path in `npm ls --depth=0 --parseable`\ndo\n package=`basename path`\n echo "$package: `npm ls --parseable $package | wc -l` dependencies"\ndone\nRun Code Online (Sandbox Code Playgroud)\n希望这已经足够了?请注意,某些包可能会被多次计数,因为传递依赖项可能会相互重叠。它\xe2\x80\x99s 还假设包名称不包含空格。
\n| 归档时间: |
|
| 查看次数: |
225 次 |
| 最近记录: |