@flowwright/plugin-std
Small workspace helpers, plus a convenience re-export of the pieces most pipelines reach for first. Everything here is a step helper — call it inside a stage body.
npm install --save-dev @flowwright/plugin-std
It depends on @flowwright/plugin-git, which comes along automatically.
API
| Export | Kind | Signature |
|---|---|---|
cleanWs | step helper | () => Promise<void> |
deleteDir | step helper | (path: string) => Promise<void> |
writeFile | step helper | (path, content, opts?: { mode?: number }) => Promise<void> |
stash, unstash | step helper | re-exported from @flowwright/core |
checkout, gitCheckout, gitClone | step helper | re-exported from plugin-git |
Example
import { pipeline, stage, sh } from "@flowwright/core";
import { cleanWs, deleteDir, writeFile } from "@flowwright/plugin-std";
export default pipeline({
name: "acme-api",
stages: [
stage("Prepare", async () => {
await deleteDir("dist");
await writeFile("build-info.json", JSON.stringify({ ci: true }, null, 2));
}),
stage("Build", {
needs: ["prepare"],
run: async () => {
await sh(["npm", "run", "build"]);
},
}),
],
});
What it composes down to
| Call | Step |
|---|---|
cleanWs() | find . -mindepth 1 -delete |
deleteDir("dist") | rm -rf -- dist |
writeFile(path, content) | a file-write step, not a shell command |
The first two are one-line shortcuts you could write yourself:
await sh(["rm", "-rf", "--", "dist"]);
writeFile is the one that earns its keep — it delegates to the core file.write
primitive, so there's no echo > redirect, no quoting to get wrong, and multi-line
content survives intact. See Commands.
Gotchas
cleanWs() empties the entire working directory. It's meant for a self-hosted
runner with a dirty workspace, not for a container that starts clean. Running it in
the middle of a pipeline deletes everything earlier stages produced.
The re-exports are a strict subset. checkout, gitCheckout and gitClone come
through, but gitTag, gitPush and checkoutStage do not — import those from
plugin-git directly.