gpt4 book ai didi

typescript - 有什么方法可以获取项目的依赖关系图?

转载 作者:搜寻专家 更新时间:2023-10-30 20:40:01 29 4
gpt4 key购买 nike

实际上,我在 gcc 中寻找类似 -M 键的东西,但对于 tsc

最佳答案

Dependency cruiser可以生成依赖图:

首先你必须通过npm安装它:

npm install --save-dev dependency-cruiser

要确保 TypeScript 支持有效,您应该首先运行:

node_modules/.bin/depcruise --info

您可以创建一个包含 TypeScript 文件之间依赖关系的 JSON 文件:

node_modules/.bin/depcruise --exclude "^node_modules" --output-type json [your_entry_point.ts] > dependencies.json

如果您安装了 graphviz 中包含的 dot 实用程序,您可以生成 SVG

node_modules/.bin/depcruise --exclude "^node_modules" --output-type dot [your_entry_point.ts] > dependencies.dot
dot dependencies.dot -T svg -o dependencies.svg

点支持很多其他output formatsgraphviz 可作为大多数 Linux 发行版的软件包使用 other operational systems as well

关于typescript - 有什么方法可以获取项目的依赖关系图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40852578/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com