Skip to main content

@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

ExportKindSignature
cleanWsstep helper() => Promise<void>
deleteDirstep helper(path: string) => Promise<void>
writeFilestep helper(path, content, opts?: { mode?: number }) => Promise<void>
stash, unstashstep helperre-exported from @flowwright/core
checkout, gitCheckout, gitClonestep helperre-exported from plugin-git

Example

pipeline.ts
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

CallStep
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.