Release with changesets and the shared toolchain, not np - #21
Conversation
RELEASE.md for this family of repos prescribed a bare `np patch` - literally always patch, decided on release day, with no changelog coming out of it at all. Changesets moves that decision into the PR that makes the change, and writes the changelog from it. The release script is @datocms/release-toolchain, the same one the four monorepos run, installed by git tag and never published to npm. In a repo that is one package it tags vX.Y.Z, which is what np tagged too, so the tag history is continuous. Claude-Session: https://claude.ai/code/session_01XaYAhzmiJwysZeq1XC5xrQ
.npmrc here sets engine-strict, and @changesets/cli requires Node ^22.11 or later, so 'npm ci' now fails outright on 18 and 20 - which is what the matrix was running. Keeping those jobs green would have meant claiming a compatibility that nobody can install into: a contributor on Node 18 cannot 'npm ci' this repo either. Both 18 and 20 are past end-of-life anyway, so the matrix was testing two dead versions and no current one. Claude-Session: https://claude.ai/code/session_01XaYAhzmiJwysZeq1XC5xrQ
One extra commit: the Node matrix moves to 22 and 24The first push turned
There is no way to keep 18 and 20 green that is also honest: So the matrix is now Note the sibling job already made the mirror-image decision, and says so: |
commit: |
47c0b05 to
d9083c4
Compare
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
This repo's root is the published package, so 'npm publish' typed at the repo root reaches the registry: it skips the tests, the changelog, the tag and the GitHub release, and npm takes it whenever the working tree carries a version the registry has not seen. Today a clean checkout carries the version already published, so the registry answers 403 - a side effect, not a decision, and it stops holding the moment somebody bumps by hand. prepublishOnly now runs 'release-toolchain --assert-release', which passes only while the release script is the one publishing. 'npm pack' runs prepack instead, so reading a tarball still works and the pkg-pr-new previews, which pack rather than publish, are untouched. Also moves the toolchain pin to v1.2.0. The lockfile is the substantive half of that: 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
One more commit:
|
This repo released with
np, via a two-lineSDKs/RELEASE.mdthatprescribed a bare
np patch— literally alwayspatch, decided on release day.There is no
CHANGELOG.mdhere at all.Changesets moves the bump level into the PR that makes the change, and writes
the changelog from it. The release script is
@datocms/release-toolchain—the same one the four DatoCMS monorepos now run, installed from its repository
by git tag and never published to npm.
The tags do not change. In a repo that is one package, changesets tags
vX.Y.Z, which is exactly whatnptagged, sogit describeand the existingtag history carry on unbroken. Verified against this branch:
What changed
.changeset/added:config.json(baseBranch: main,access: public—which is what makes the scoped package publish publicly without a
publishConfig) and the standardREADME.mdexplaining the bump levels.@changesets/cliand@datocms/release-toolchainadded;npremoved — itwas pinned at five different versions across these seven repos, with zero
configuration anywhere, so nothing is lost.
changeset,releaseandrelease:nextscripts. The release script must notbe called
publish: this repo's root is the published package, sochangeset publish→npm publishwould run apublishscript and therelease would re-enter itself.
CHANGELOG.mdadded tofiles, so the changelog changesets is about to startwriting ships with the package.
The build
npm run buildhere issvelte-kit sync && svelte-package -o package, whichregenerates
.svelte-kit/tsconfig.jsonon the way — so the toolchain's plainnpm run buildis enough and no special case is needed.prepublishOnlyruns ita second time inside
npm publish, which is harmless and left alone.How to try it
The first release should be a prerelease, which is real in every way except the
dist-tag:
latestis untouched and the GitHub release is marked as a prerelease.https://claude.ai/code/session_01XaYAhzmiJwysZeq1XC5xrQ