Skip to content

Release with the shared toolchain instead of a local copy - #52

Merged
stefanoverna merged 3 commits into
mainfrom
release-toolchain
Aug 31, 2026
Merged

Release with the shared toolchain instead of a local copy#52
stefanoverna merged 3 commits into
mainfrom
release-toolchain

Conversation

@stefanoverna

@stefanoverna stefanoverna commented Aug 31, 2026

Copy link
Copy Markdown
Member

toolchain/publish.mjs here was the most evolved of four 88–97% identical copies
of the same ~280-line script — the only one that ever got the fix letting an
interrupted release resume (f145fea), which is why
@datocms/release-toolchain is a
port of this file. The code that releases this repo after the merge is the code
that has been releasing it.

The toolchain is shared by all eleven DatoCMS repos that publish to npm, and is
installed from its repository by git tag rather than published: the @datocms
scope on npm is what customers install, and internal automation does not belong
there. It also means fixing a release bug is a commit and a tag, not a release —
no bootstrap paradox.

What changed

  • toolchain/publish.mjs (–280 lines) → toolchain/release.mjs (+30), which is
    the oclif README regeneration and nothing else, passed as the shared script's
    one hook: beforeCommit, after changeset version and the lockfile refresh,
    after the publish plan is read, before git add -A && git commit. Same place
    in the order it ran before, comments included.
  • publishrelease, publish-nextrelease:next. Harmless in this repo,
    where the root package.json is private, but publish is a name npm runs
    itself during npm publish; the single-package repos migrating next would
    re-enter their own release script if they kept it.
  • @manypkg/get-packages dropped — the deleted script was its only consumer.
  • Docs updated in README.md, CLAUDE.md and .changeset/README.md.

The one behaviour change

A release that moves several packages to different versions now gets
release: 4 packages as its subject and the name@version list in the commit
body, instead of all of them spelled into the subject — where a release
touching everything ran to 442 characters. One package alone is still named
(release: datocms@4.2.1); everything on one version is still
release: v4.2.1, which is the usual outcome in a linked group.

Two things the shared script adds

  • The tag is derived (vX.Y.Z when the repo is one package, name@version in a
    workspace) rather than hard-coded, and a step between changeset publish and
    git push checks that its derivation and changesets' agree — while the only
    thing that has happened is a publish.
  • The preflight prints the toolchain version, so a repo running a stale pin is
    visible in the release log.

https://claude.ai/code/session_01XaYAhzmiJwysZeq1XC5xrQ

Stefano Verna added 2 commits August 31, 2026 11:55
toolchain/publish.mjs here was the most evolved of four 88-97% identical
copies of the same script - the only one with the resume fix - and
@datocms/release-toolchain is a port of exactly this file, so the code that
releases this repo is the code that has been releasing it.

What is left behind is toolchain/release.mjs: the oclif README regeneration,
which has to happen between the version bump and the release commit, passed
as the shared script's one hook.

The scripts are renamed publish -> release, publish-next -> release:next,
because 'publish' is a name npm runs itself during 'npm publish'.

Claude-Session: https://claude.ai/code/session_01XaYAhzmiJwysZeq1XC5xrQ
Rehearsing the resume against a real registry and a real GitHub repo turned
up a bug that every copy of the old script had: killed between
'changeset publish' and 'git push', the next run reads an empty plan - the
packages are on the registry and their tags are local, which is all
changesets looks at - and aborts with 'there is nothing to release', leaving
the commit unpushed and no GitHub release. v1.1.0 finishes that release.

Claude-Session: https://claude.ai/code/session_01XaYAhzmiJwysZeq1XC5xrQ
@pkg-pr-new

pkg-pr-new Bot commented Aug 31, 2026

Copy link
Copy Markdown

Open in StackBlitz

datocms

npm i https://pkg.pr.new/datocms@4cac116

@datocms/cli

npm i https://pkg.pr.new/@datocms/cli@4cac116

@datocms/cli-plugin-contentful

npm i https://pkg.pr.new/@datocms/cli-plugin-contentful@4cac116

@datocms/cli-plugin-wordpress

npm i https://pkg.pr.new/@datocms/cli-plugin-wordpress@4cac116

@datocms/cli-utils

npm i https://pkg.pr.new/@datocms/cli-utils@4cac116

commit: 4cac116

v1.2.0 adds a guard a package runs from prepublishOnly to refuse a
hand-typed 'npm publish'. This repo does not use it: the root package.json is
private, so the same slip publishes nothing. The seven single-package repos
carry it, where 'npm publish' at the repo root does reach npm.

The lockfile is the substantive part of this commit. Changing the spec alone
left the previous SHA resolved, so 'npm ci' kept installing v1.0.0 while
package.json claimed otherwise.

Claude-Session: https://claude.ai/code/session_01XaYAhzmiJwysZeq1XC5xrQ
@stefanoverna
stefanoverna merged commit 7f3ec5f into main Aug 31, 2026
2 checks passed
@stefanoverna
stefanoverna deleted the release-toolchain branch August 31, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant