Workspace builds
flog build runs ordinary build script lifecycles across a source-workspace
graph. It schedules each selected workspace at most once in deterministic
dependency-first order and then builds the selected app itself. A package with
no build script is reported as skipped, but traversal continues through it so
its transitive workspace dependencies still build. Actual script failures,
cycles, missing dependencies, and interruption remain errors.
See the flog build command summary for its
selection and reporting flags.
Install the matching lock, including development tools, first. From a monorepo
root, flog build follows the root's non-development workspace dependencies and
finally runs the root's own build script when present:
flog install
flog build
From inside a workspace package, plain flog build selects that package and
its workspace dependency closure through dependencies, applicable
optionalDependencies, and required peer providers. Development-only workspace
edges are not build inputs. --workspace <selector> makes the selection
explicit from any directory and accepts a package name, workspace directory,
owned file, or path glob. Relative paths resolve from --cwd (or the process
directory). Repeated selectors must all be exact or all be globs, and aliases or
overlapping globs that select one workspace twice are rejected. --cwd only
changes where Flog locates the project and default package—it is not another
selector.
flog build has no production mode. A source build requires compilers and other
development tools, so run it after a normal flog install, never after a
runtime-only flog install --prod. Use flog run build when only the current or
explicitly selected package's script should run without dependency expansion.
Build scripts and reporting#
Each selected package's normal prebuild, build, and postbuild lifecycle
runs when build exists. Missing build scripts are allowed and reported, so no
--if-present flag is needed. General flog run remains strict unless its own
--if-present option is supplied.
flog build is one graph-aware operation, not a recursive shell script. Remove
package prebuild hooks whose only purpose was a nested dependency query such
as flog run --workspace ... --dependencies-only --if-present build; otherwise
that hook requests overlapping work while the selected app is already being
built. Ordinary lifecycle hooks that perform package-local work remain valid.
Default execution is sequential and fail-fast. Validation can retain all permitted outcomes or schedule independent workspaces in parallel:
flog build --no-bail
flog build --no-bail --jobs auto
flog build --workspace apps/website --json > build-results.json
Human and JSON output deterministically list selected workspaces, omitted
development-only workspaces, build-less skips, failures, blocked dependents,
interruptions, and nested-work reuse evidence. --jobs requires --no-bail;
--json implies it. Scripts that invoke Flog join the existing authenticated
command coordinator, preserving cancellation and at-most-once compatible work.
Coordination identity includes each package's effective selected dependency
subgraph, so overlapping builds reuse equivalent dependency work.