node.js - 在 Arkit 中配置 JSON 以可视化 Package.json 中的 NPM 模块
问题描述
我正在使用以下名为arkit的 npm 包来创建 node.js 项目的架构图,但是我无法在我的 node.js 应用程序架构中可视化 npm 包(依赖项文件夹),如 Arkit 和 Vue/ 示例中所述Nuxt TodoMVC,我尝试遵循它们各自 arkits 的 json 配置,但它们要么像 Vue 中那样不存在,要么像 Arkit 本身那样模糊。我使用了 arkit 配置示例中给出的配置,但我最终得到了像这样的主要依赖项的所有依赖项。我尝试了以下配置
{ "$schema": "https://arkit.pro/schema.json",
"excludePatterns": ["test/**", "tests/**", "**/*.test.*", "**/*.spec.*"],
"components": [
{ "type": "Dependency",
"patterns": ["node_modules/**/*.js"] },
{ "type": "Component",
"patterns": ["**/*.js", "**/*.jsx"]
}
],
"output": [
{ "path": "arkit.svg",
"groups": [ { "first": true, "components": ["Component"] },
{
"type": "Dependencies",
"components": ["Dependency"]
}
]
}
]
}
但它在架构生成过程中崩溃了,我还通过电子邮件发送了这个 npm 包的所有者和另一个成功设法这样做的人,但他们正忙着指导我配置 arkit 的 JSON。我可以在 JSON 配置文件中使用 for-of 循环,以便仅获取 package.json 中包含的那些 node_modules,因为我不想在架构表示中获取主要 npm 包的其他子依赖项,如图所示在上面分享的链接中!
TL;DR 我想要具有此类依赖关系的图表,但我 尝试过,在命令行“npx arkit --config test.json --depth=0”中添加 --depth=0 但没有运气
解决方案
我认为 arkit 期望 output.path 是一个数组 - 但你传递给它一个字符串。尝试使用修改后的配置:
{
"$schema": "https://arkit.pro/schema.json",
"excludePatterns": ["test/**", "tests/**", "**/*.test.*", "**/*.spec.*"],
"components": [{
"type": "Dependency",
"patterns": ["node_modules/*"]
},
{
"type": "Component",
"patterns": ["**/*.js", "**/*.jsx"]
}
],
"output": [{
"path": ["arkit.svg"],
"groups": [{
"first": true,
"components": ["Component"]
},
{
"type": "Dependencies",
"components": ["Dependency"]
}
]
}]
}
推荐阅读
- javascript - 获取超过 100 条消息
- go - 如何让 json 响应在 go 中正常工作
- angular - Angular:从组件重定向到组件
- algorithm - 为潮汐预报器建模
- html - 将 Select 元素设置为具有透明背景的问题
- ios - 在运动事件(摇动)上更改集合视图单元格中的 UILabel
- c# - C# 在发布中的 ASP.NET 中创建 SQLite 数据库导致空数据库
- php - 如何防止 PHP 在我的浏览器上显示为纯文本?
- node.js - Pug/Jade,根据复选框值隐藏/显示元素
- java - 使用 GoogleSignInClient 时没有帐户选择器