tomato·bazeldocs v0 · latest
Docs/Reference/Modules/rules_astro

rules_astro

Bazel rules for building Astro sites hermetically (astro_site / astro_dev)

Latest0.0.1
Versions1
CategoryBazel rules
Compat level1
MaintainersMatt Marshall
Registryhttps://registry.tbzl.dev/modules/rules_astro/
Sourcegithub.com/tomato-bazel/rules_astro
MODULE.bazelstarlark
bazel_dep(name = "rules_astro", version = "0.0.1")

View source & releases on GitHub ↗

Build Astro sites hermetically under Bazelastro build runs as a cacheable, RBE-eligible action producing a static dist/ TreeArtifact.

Generic (no fastverk coupling); the reusable build layer for fastverk/site, docs portals, and blogs. Sibling of rules_fastverk_plugin / rules_ci / rules_meridian in tomato-bazel; publish to the bazel-registry for consumption.

Status: validated. astro_site builds fastverk/site (19 pages) hermetically as a single JsRunBinary action on Bazel 7.4.1 + aspect_rules_js 2.1.3, producing the static dist/ TreeArtifact — remotely cacheable / RBE-eligible.

Use

MODULE.bazel:

bazel_dep(name = "rules_astro", version = "0.0.1")
bazel_dep(name = "aspect_rules_js", version = "2.1.3")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml")
use_repo(npm, "npm")

site/BUILD.bazel:

load("@aspect_rules_js//npm:defs.bzl", "npm_link_all_packages")
load("@npm//:astro/package_json.bzl", astro_bin = "bin")
load("@rules_astro//astro:defs.bzl", "astro_site", "astro_dev")

npm_link_all_packages(name = "node_modules")
astro_bin.astro_binary(name = "astro_tool")   # the astro CLI as a js_binary

astro_site(
    name = "build",                     # -> dist/ (static, hermetic, RBE-cacheable)
    srcs = glob(["src/**", "public/**"]) + ["astro.config.mjs", "package.json", "tsconfig.json"],
    astro_bin = ":astro_tool",
    node_modules = ":node_modules",
    data = [":features_json"],          # generated inputs (feature catalog, OG cards)
)

astro_dev(name = "dev", srcs = glob(["src/**", "public/**"]), astro_bin = ":astro_tool", node_modules = ":node_modules")
bazel build //site:build     # -> bazel-bin/site/build/ (dist)
bazel run   //site:dev       # local preview

API

  • astro_site(name, srcs, config, data, astro_bin, out_dir, chdir, env, **kwargs)
  • astro_dev(name, srcs, config, data, astro_bin, **kwargs)

See astro/defs.bzl for the full docstrings.

Conformance#

No gate findings. 11 contested atoms. See how gating works or the full report.

Contested atoms

Third-party modules where this module resolves a different version than others do. Not a violation of anything this module did — it is the actionable form of a registry-level convergence finding, and the sentence a maintainer can act on.

AtomResolved hereElsewhere
apple_support 1.24.2 2.2.0 ×1
aspect_bazel_lib 2.8.1 2.22.5 ×29
aspect_rules_js 2.1.3 3.1.2 ×17
bazel_skylib 1.8.2 1.9.0 ×2
nlohmann_json 3.6.1 3.12.0.bcr.1 ×1
protobuf 33.4 34.0.bcr.1 ×2
rules_jvm_external 6.7 6.8 ×4
rules_nodejs 6.3.0 6.7.3 ×16.7.4 ×16
rules_python 1.7.0 2.0.1 ×1
rules_swift 3.1.2 3.6.1 ×1
upb 0.0.0-20220923-a547704 0.0.0-20230516-61a97ef ×1

Dependencies#

rules_astro in the registry graph — what it depends on (left) and what depends on it (right).

Depends on

aspect_rules_js2.1.3rules_nodejs6.3.0bazel_skylib1.7.1platforms0.0.10

Used by (1 in the registry)

Versions#

1 published version, newest first. Each resolves to an immutable, integrity-checked archive.

VersionIntegrity (sha256)Source archive
0.0.1 latest OInfQJAgfwbiIOQ/… tag archive ↗

← All modules