What does HackerNews think of rules_nodejs?
JavaScript and NodeJS rules for Bazel
Not impossible, but you really need to go all in with it and follow its conventions and practices. See this for the main docs: https://github.com/bazelbuild/rules_nodejs
One thing in particular that doesn't work well in the bazel world is doing your own stuff outside its BUILD.bazel files. If you're used to just npm install and jam some code in your package.json scripts... that doesn't usually work in the bazel world. If you have a lot of logic or tools in your build you'll likely need to go all in and make bazel starlark rules or macros that recreate that logic. Nothing is impossible, but expect to spend time getting up to speed and getting things working the bazel way.
Once you familiarize yourself with the concept of rules and targets, you can follow the instructions for whichever ruleset you want to use. The official one for JS is rules_nodejs[2]
Another thing that really helped me cement my understanding of Bazel was to deep dive into Starlark and write my own rules. The examples repo[3] is a great resource for that
[1] https://docs.bazel.build/versions/0.29.1/tutorial/java.html
[2] https://github.com/bazelbuild/rules_nodejs
[3] https://github.com/bazelbuild/examples/tree/master/rules
Tangentially related to package manager integration: Bazel can now build with CMake in-tree [2].
[0] https://github.com/bazelbuild/rules_nixpkgs/
For that, Bazel needs someone to write all the necessary configs, and make them available out-of-the box, with sane presets baked-in.
You can look at Angular team's working on integrating Bazel into their build process, here's the repo: https://github.com/alexeagle/angular-bazel-example
There's:
- build.bazel
- Workspace
And then there are rules that have to be included and/or developed:
- nodejs rules, https://github.com/bazelbuild/rules_nodejs
- sass rules https://github.com/bazelbuild/rules_sass
- typescript rules: https://github.com/bazelbuild/rules_typescript
etc.
And those rules have to be not only loaded, but specific steps from those rules have to be invoked (see WORKSPACE).
I'd say there still still a lot of configuration involved in setting up all the moving pieces. Will it get better? Hopefully (there are just not enough good/decent build tools).