从Bazel依赖关系图中排除@ npm //依赖关系bazel查询

问题描述

我使用以下命令为Bazel项目生成图形。

bazel query 'deps(//services/gateway:lib)' --output graph --nohost_deps --noimplicit_deps > graph.in
dot -Tpng < graph.in > graph.png

将生成以下图形:

digraph mygraph {
  node [shape=box];
  "//services/gateway:lib"
  "//services/gateway:lib" -> "//services/gateway:controllers/auth.controller.ts\n//services/gateway:index.ts\n//services/gateway:controllers/index.controller.ts\n//:tsconfig.json\n//services/gateway:controllers/index.ts"
  "//services/gateway:lib" -> "@npm//@types/node:node"
  "//services/gateway:lib" -> "@npm//inversify-express-utils:inversify-express-utils"
  "//services/gateway:lib" -> "@npm//helmet:helmet"
  "//services/gateway:lib" -> "@npm//inversify:inversify"
  "@npm//inversify:inversify"
  "@npm//inversify:inversify" -> "@npm//inversify:inversify__contents"
  "@npm//inversify:inversify" -> "@npm//inversify:inversify__files"
  "@npm//inversify:inversify" -> "@bazel_tools//src/conditions:host_windows"
  
   MANY MORE LINES

 "@npm//:node_modules/bytes/index.js\n@npm//:node_modules/bytes/History.md\n@npm//:node_modules/bytes/Readme.md\n@npm//:node_modules/bytes/LICENSE\n@npm//:node_modules/bytes/package.json"
  "@npm//methods:methods__nested_node_modules"
  "@npm//array-flatten:array-flatten__files"
  "@npm//array-flatten:array-flatten__files" -> "@npm//:node_modules/array-flatten/LICENSE\n@npm//:node_modules/array-flatten/array-flatten.js\n@npm//:node_modules/array-flatten/README.md\n@npm//:node_modules/array-flatten/package.json"
  "@npm//:node_modules/array-flatten/LICENSE\n@npm//:node_modules/array-flatten/array-flatten.js\n@npm//:node_modules/array-flatten/README.md\n@npm//:node_modules/array-flatten/package.json"
}

如您所见,由于@npm//<something>中的所有依赖关系,该图非常庞大

ra

我真正想要的是这样的东西:

digraph mygraph {
  node [shape=box];
  "//services/gateway:lib"
  "//services/gateway:lib" -> "//services/gateway:controllers/auth.controller.ts\n//services/gateway:index.ts\n//services/gateway:controllers/index.controller.ts\n//:tsconfig.json\n//services/gateway:controllers/index.ts"
  "//services/gateway:lib" -> "@npm//@types/node:node"
  "//services/gateway:lib" -> "@npm//inversify-express-utils:inversify-express-utils"
  "//services/gateway:lib" -> "@npm//helmet:helmet"
  "//services/gateway:lib" -> "@npm//inversify:inversify"
}

good graph


是否可以在不手动将它们从graph.in文件中删除的情况下,删除图中所有npm依赖项?

解决方法

在描述您感兴趣的目标(例如使用npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view )时,您应该可以多ask for,或者在这种情况下可以少{{3}}:

deps()

或:

deps(//services/gateway:lib) except @npm//...:*

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...