Build and preview Astro’s official starter templates
pnpm build
— Download all official Astro examples and build thempnpm preview
— Serve the build output on http://localhost:3000 (runpnpm build
first)
-
When examples in the Astro monorepo change, we run the build script in this repo (
pnpm build
). -
It downloads examples from the
astro
andstarlight
repositories to.templates/
and installs dependencies for them (seesrc/download.mjs
). -
For each example, it adds a build script and then runs it in a subprocess for that example. (This allows each example to use its own versions of dependencies etc.) Each example is built with a
base
property matching its name and a custom integration which prefixesbase
in other places. -
The build output for each example is moved to a subdirectory in
dist/
. -
The totality of
dist/
can then be hosted as a static site with each example available at a subpath, e.g./blog/
pointing to the blog example,/starlight-basics/
to the Starlight starter example, etc.