rules_js icon indicating copy to clipboard operation
rules_js copied to clipboard

[Bug]: pnpm workspace projects with no `pkg` cause `rdeps` query failures

Open jbedard opened this issue 1 year ago • 1 comments

What happened?

Some pnpm workspace projects have no npm_package target (the name defined by npm_translate_lock(npm_package_target_name)) because they are never linked into the package store. Projects such as "apps" are part of the pnpm workspace, have dependencies etc, but will most likely never be depended on so do not have npm_package targets. However it seems that target may still be referenced by a target generated by rules_js.

Version

Language(s) and/or frameworks involved: ts+js

How to reproduce

Declare a pnpm workspace, 2 projects, 1 project without an `npm_package`, then run an `rdeps` query such as:

bazel query 'rdeps(//...)'

Any other information?

No response

jbedard avatar Jul 02 '24 18:07 jbedard

Ran a query to trace paths between one of the files I was searching for rdeps of and the package that was missing.

Query:

bazel query "allpaths( \
  '//packages/common:common_npm_package', \
  '//packages/common:workflows/workflowsDependencyGraph.ts')"

Result:

//packages/common:_common_swcrc
//packages/common:_common_swcrc_copy_srcs_to_bin
//packages/common:_common_swcrc_js_filegroup
//packages/common:_gen_tsconfig_common
//packages/common:common
//packages/common:common_npm_package
//packages/common:common_npm_package_files
//packages/common:common_transpile
//packages/common:common_typings
//packages/common:tsconfig_common.json
//packages/common:workflows/workflowsDependencyGraph.ts

stabai avatar Jul 02 '24 20:07 stabai