A pnpm workspace
Releasing a pnpm workspace takes the same shape as an npm monorepo. You will notice three differences that
come from the package manager rather than from dispat. The lock file lives at the workspace root, internal ranges use
the workspace: protocol, and pnpm publish checks your git tree state.
{
"scripts": {
"pnpm-build": "pnpm install --frozen-lockfile && pnpm run build",
"pnpm-publish": "pnpm publish --access public --no-git-checks",
"pnpm-lock": "pnpm install --lockfile-only"
},
"spaces": {
"libs": {
"path": "packages",
"autoVersion": {
"enabled": true,
"range": "workspace:*",
"syncLock": [
"pnpm-lock"
]
},
"flow": {
"build": "pnpm-build",
"publish": "pnpm-publish"
}
}
},
"commit": {
"enabled": true,
"include": [
"pnpm-lock.yaml"
]
}
}
- The install runs from the package folder and installs the workspace anyway. pnpm looks upward for
pnpm-workspace.yaml. Your build stage does not need-C ../... Pass--frozen-lockfileto make the stage fail locally on a mismatched lock file, instead of quietly resolving something new mid-release. workspace:*ranges stay as they are.autoVersionwrites each package's ownversionfield.pnpm publishsubstitutes that version for theworkspace:specifier when it packs, so your declared ranges never need rewriting. Setrange: "workspace:*"to write this literal back verbatim and keep the protocol intact.pnpm-lock.yamlis outside every package folder. UsesyncLockto regenerate it after the version stage, and add it tocommit.includeto put it in the release commit. Without this line, your release commit carries rewritten manifests and a stale lock file. The one-at-a-timesyncLockConcurrencydefault matters here because every package in the workspace regenerates the same file.--no-git-checks.pnpm publishrefuses to publish from a dirty working tree or an unapproved branch. A dispat run creates exactly that situation, because the version stage rewrites manifests and dispat creates the release commit after the publishes. Pass this flag to bypass the check and rely on the annotated tag as the record of what shipped.
Yarn workspaces work the same way. Put yarn.lock in commit.include and use yarn npm publish in the publish slot.