rules_nodejs icon indicating copy to clipboard operation
rules_nodejs copied to clipboard

Question: is it possible to generate BUILD files for a Yarn workspaces project?

Open ThijsBroersen opened this issue 3 years ago • 1 comments

I like using Bazel but I find it a pain that I have to maintain a duplicate list of the same dependencies:

  • one in package.json
  • one in BUILD.bazel

Is there a more ergonomic way of working? Can Bazel read dependencies (and perhaps also other data sources) directly from the package.json and tsconfig files?

ThijsBroersen avatar May 17 '22 07:05 ThijsBroersen

The typical way for bazel BUILD files to reflect contents of other files in the repo is with a bazel-gazelle extension. https://github.com/bazelbuild/bazel-gazelle#supported-languages

However that's quite a bit of work for something simple like keeping two lists in sync. Maybe you can just write a small script to compare/correct them and run that as part of your CI?

Note, there's pnpm workspaces support in https://github.com/aspect-build/rules_js/ and I'm planning to write a gazelle extension to keep package.json files in-sync with the js_package rules used by that ruleset.

alexeagle avatar May 17 '22 14:05 alexeagle

This issue has been automatically marked as stale because it has not had any activity for 6 months. It will be closed if no further activity occurs in 30 days. Collaborators can add a "cleanup" or "need: discussion" label to keep it open indefinitely. Thanks for your contributions to rules_nodejs!

github-actions[bot] avatar Nov 17 '22 02:11 github-actions[bot]

This issue was automatically closed because it went 30 days without any activity since it was labeled "Can Close?"

github-actions[bot] avatar Dec 18 '22 02:12 github-actions[bot]