Anybuild documentation
Adding Build Steps
Extend generated provider builds without replacing their detected defaults.
Start from the generated definition
Terminal
anybuild generate .The generated file constructs the detected typed provider config, calls the provider build function, and passes its build struct into a serve function. Keep that composition and add steps around it.
Run before or after the provider build
Anybuild
load("//anybuild/tools:node.bzl", "node_build", "node_config", "node_serve")
config = node_config( schema = 1, node_server = "node", node_version = "24",)
build = node_build(config)
node_serve( config, build, build_pre = [run("node scripts/check.js", group = "check")], build_post = [run("node scripts/prerender.js", group = "build")],)Step builtins
| Builtin | Purpose |
|---|---|
dep() | Declare a build or runtime package. |
use() | Expose packages to later build steps. |
run() | Execute a shell command with optional groups and I/O. |
copy() | Copy project or embedded asset files. |
workdir() | Change the build working directory. |
env() | Set variables for following build steps. |
write() | Create a file during the build. |
path() | Prepend a directory to PATH. |
Compose providers
Provider build functions return ordinary structs. A documentation generator can use Python build steps and then pass the resulting static output into staticfile_serve; Laravel similarly combines PHP and Node.js work. Custom files can use the same pattern.