Skip to content

chore(release): bump from package.json instead of npm - #2136

Merged
BlankParticle merged 1 commit into
mainfrom
chore/release-version-from-package-json
Oct 7, 2026
Merged

BlankParticle merged 1 commit into
mainfrom
chore/release-version-from-package-json

Conversation

@BlankParticle

Copy link
Copy Markdown
Member

scripts/release/prepare.ts now takes the release version from package.json instead of npm. This is the same change as alchemy-run/distilled#836.

Why

prepare.ts worked out the next prerelease from npm: the highest 2.0.0-<channel>.N across packages, plus whether the v2.0.0-<channel>.N git tag existed. If any package was missing that N, it treated the release as unfinished and published N again.

A package added after the last release never has that version on npm. So the first release after adding one repeats the previous candidate instead of bumping. Distilled hit this with @distilled.cloud/iceberg.

patch / minor / major also bumped from the latest stable version on npm, not from the repository.

What changes

prepare.ts reads the version every packages/*/package.json shares, fails if they differ, and bumps from it. It never asks npm or git tags.

Spec From 2.0.0-beta.81
beta (default) 2.0.0-beta.82
rc 2.0.0-rc.1
beta.N, rc.N, alpha.N that candidate; must be newer
patch / minor / major the semver bump (major gives 2.0.0)
x.y.z[-beta.N] exactly that version; must be newer
anything else 0.0.0-<name>, published but not committed
  • A version that isn't newer fails: alpha from a beta, beta.81, or a lower x.y.z.
  • Mismatched versions fail before anything is written, listing the odd ones out, e.g. found 2.0.0-beta.81: 6 packages; 2.0.0-beta.80: @alchemy.run/pkg.
  • The shared-version check (sharedVersion) moves into scripts/package-manifest.ts, so validate-publish-packages.ts and prepare.ts use the same code.
  • publishablePackages now skips stray files like .DS_Store in packages/. Before, it crashed on them.
  • publish.ts is unchanged: it still skips tarballs whose version is already on npm, so a publish job that fails partway can be re-run.

Testing

  • Ran prepare.ts with each spec above against the current packages, plus a deliberate version mismatch, and reverted each run's changes.
  • pnpm validate:publish-packages passes.
  • tsc -b tsconfig.scripts.json, pnpm format:check and oxlint pass.

prepare.ts reads the version every packages/*/package.json shares, fails
when they differ, and bumps from it. It no longer asks npm and git tags
for the next version, so a package that is not on npm yet no longer makes
the release repeat the previous candidate.
@BlankParticle
BlankParticle merged commit 6b5eb23 into main Oct 7, 2026
2 checks passed
@BlankParticle
BlankParticle deleted the chore/release-version-from-package-json branch October 7, 2026 19:36
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