Scaffold a new Bazel workspace

Bazel has a reputation for being complicated, and one reason is that it doesn't come with reasonable default behaviors. I've written about this before, for example https://blog.aspect.build/bazelrc-presets. Since there's not much pressure on the Bazel team to improve ergonomics, even the root folder of a Bazel workspace needs at least six files to be well-formed. (Why does the Bazel version have to go in .bazelversion instead of .bazelrc for example?) As you add languages to your monorepo, you need even more boilerplate.

Aspect CLI has an init command for the purpose of making this more convenient, and I'm excited about improvements we've made to it recently. Roll the demo!

asciicast

To try it out yourself, just install and run the command:

% brew install aspect-build/aspect/aspect
% aspect init

to install on other platforms, see github.com/aspect-build/aspect-cli/releases

This scaffolding is powered by a separate GitHub repo: https://github.com/aspect-build/aspect-workflows-template. This way we can keep the dependencies at latest, and update the template independently from CLI releases. We plan to add a lot more features to this soon.

Note that monorepos aren't created very often; in fact the whole point is to avoid a commonly used "new project" scaffold. However even if you don't need to make your own repo, this is useful to create a minimal repro of some Bazel issue, it's great for developers who are just getting started with Bazel, and it also serves as a "kitchen sink" example of a working Bazel setup.

This is using an excellent library: https://hay-kot.github.io/scaffold/. Please thank and support the developer behind it: https://github.com/sponsors/hay-kot! We understand OSS is a labor of love, and want to send love back to engineers who make our lives easier.