fix(publish): release packages in dependency order #49

Merged
crapougnax merged 1 commit from fix/48-publish-dependency-order into develop 2026-11-15 17:16:32 +00:00
Member

Problem

bin/publish_all.js builds in dependency order (Turborepo) but released packages in alphabetical order. A package was packed before its dependencies received their new version, so its workspace:* ranges became the previous version:

  • @quatrain/backend@1.2.23-beta.1 declares @quatrain/core ^1.2.20, while the code it needs is in core 1.2.21-beta.1.

A ^1.2.20 range does not accept a 1.2.21 beta, so a consumer of the beta gets a core without that code.

Change

  • bin/dependencyOrder.js: sortByDependencies() orders workspace packages dependencies first, from their runtime dependencies and peers; independent packages stay in alphabetical order; a cycle stops the release with the packages involved.
  • bin/publish_all.js uses that order for hashing and releasing.
  • Branch rule: a release from develop (beta) may declare beta dependencies. A release from main (stable) that would declare a prerelease runtime dependency now stops the job. In dependency order this cannot happen in a normal release, since betas are finalised before their dependents; the check is a safeguard.

Effect on the next run on develop

The changed packages are released again, each declaring the beta of its changed dependencies (backend -> core ^1.2.21-beta.N, and so on).

Not covered

A package whose own code did not change is not released again when only a dependency changed. Its published range still accepts the last stable version of that dependency, which is correct as long as it does not need the new code.

Checks

  • Helper checked by hand on sample graphs (chain, peers, development dependencies ignored, cycle).
  • Run on the 83 packages of this repository: no cycle; types < core < backend < backend-postgres, identifiers and backend < tenancy.
  • The release itself only runs on develop and main; the script has no automated test.

Closes #48

🤖 Generated with Claude Code

## Problem `bin/publish_all.js` builds in dependency order (Turborepo) but released packages in alphabetical order. A package was packed before its dependencies received their new version, so its `workspace:*` ranges became the previous version: - `@quatrain/backend@1.2.23-beta.1` declares `@quatrain/core ^1.2.20`, while the code it needs is in `core 1.2.21-beta.1`. A `^1.2.20` range does not accept a `1.2.21` beta, so a consumer of the beta gets a `core` without that code. ## Change - `bin/dependencyOrder.js`: `sortByDependencies()` orders workspace packages dependencies first, from their runtime dependencies and peers; independent packages stay in alphabetical order; a cycle stops the release with the packages involved. - `bin/publish_all.js` uses that order for hashing and releasing. - **Branch rule**: a release from `develop` (beta) may declare beta dependencies. A release from `main` (stable) that would declare a prerelease runtime dependency now stops the job. In dependency order this cannot happen in a normal release, since betas are finalised before their dependents; the check is a safeguard. ## Effect on the next run on `develop` The changed packages are released again, each declaring the beta of its changed dependencies (`backend` -> `core ^1.2.21-beta.N`, and so on). ## Not covered A package whose own code did not change is not released again when only a dependency changed. Its published range still accepts the last stable version of that dependency, which is correct as long as it does not need the new code. ## Checks - Helper checked by hand on sample graphs (chain, peers, development dependencies ignored, cycle). - Run on the 83 packages of this repository: no cycle; `types` < `core` < `backend` < `backend-postgres`, `identifiers` and `backend` < `tenancy`. - The release itself only runs on `develop` and `main`; the script has no automated test. Closes #48 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(publish): release packages in dependency order (#48)
All checks were successful
Quatrain Core CI / Monorepo Build, Tests & Quality Audit (pull_request) Successful in 2m55s
Quatrain Core CI / Publish Changed Packages to npm (pull_request) Has been skipped
0827afa6b4
Packages were built in dependency order but released in alphabetical
order: a package was packed before its dependencies received their new
version, so a beta declared the previous stable version of a dependency
whose new code it needs.

- packages are released dependencies first (runtime dependencies and
  peers), alphabetically among independent packages; a cycle stops the
  release;
- a stable release that would declare a prerelease dependency stops the
  release. Beta releases may depend on betas.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
crapougnax merged commit 8badd0099d into develop 2026-11-15 17:16:32 +00:00
crapougnax deleted branch fix/48-publish-dependency-order 2026-11-15 17:16:32 +00:00
Sign in to join this conversation.
No description provided.