Skip to content

Command

Source: src/Build/Command.ts

A Build resource that runs a shell command and produces an output asset. Input files are hashed using globs to avoid redundant rebuilds.

const build = yield* Build("vite-build", {
command: "npm run build",
cwd: "./frontend",
outdir: "dist",
});
yield* Console.log(build.path); // absolute path to dist directory
yield* Console.log(build.hash); // hash of input files
const build = yield* Build("production-build", {
command: "npm run build",
cwd: "./app",
output: "dist",
env: {
NODE_ENV: "production",
API_URL: "https://api.example.com",
},
});
const build = yield* Build("custom-build", {
command: "npm run build",
cwd: "./app",
output: "dist",
memo: { include: ["src/*", "package.json"], exclude: ["node_modules", "dist"] },
});