Skip to content

Latest commit

 

History

History
85 lines (65 loc) · 5.19 KB

versioning.md

File metadata and controls

85 lines (65 loc) · 5.19 KB

Versioning

canc packages are split into two tiers. Both stay on major version 1 for a long time: a major release is reserved for changes big enough to need one, such as dropping a build target or a platform. Day-to-day change, including some breaking change, happens inside minors.

Core and ecosystem

Core is @cancjs/promise and @cancjs/coroutine (plus @cancjs/promise-legacy once it ships). These packages change rarely. Outside a major release they never remove an export, a type or an option, so a caret pin never loses a name you call. A core minor can still fix behavior that was wrong. When a fix can break code that worked, the changelog entry for that minor opens with a **Breaking:** note, so read the changelog before you take the minor. Pin core with a caret, ^1, the same default npm install already writes.

Ecosystem is everything else: @cancjs/toolbox, @cancjs/toolbox-native, @cancjs/decorators, @cancjs/fetch, @cancjs/axios, @cancjs/unhandled-rejection, @cancjs/node, and the server adapters as they ship. These packages release on a shared minor line. When one of them needs a breaking change, every package in that release moves to the same new minor together, so a change that would otherwise strand a consumer between two incompatible versions ships as one coordinated step instead.

Because an ecosystem minor can change behavior, pin these packages with a tilde, ~1.4, so npm update only reaches new patches. Moving to a new minor is then a decision you make by reading the changelog, not something that happens on its own.

What a minor may and may not do

In both tiers, a minor release is allowed to:

  • add a new export, option, or overload
  • change an internal default
  • restrict a type to be more precise than before
  • rename an export, as long as the old name keeps working under a deprecation notice
  • remove a member from a return type's declared failure set
  • fix behavior that was wrong, marked **Breaking:** in the changelog when the fix can break code that worked

A minor release is never allowed to remove something public. Deleting an export, a type, or an option is a major-only change in both tiers. That rule is what makes the tilde pin safe for the ecosystem tier: a minor can surprise you with new behavior, but it will never make a function you already call disappear out from under you.

The declared failure set (TFailure on CancelablePromise) is part of a function's type contract. In ecosystem-tier packages, adding a new failure type to a return type's declared failure set is breaking in the same way any other type narrowing is, because consumers handling failure types exhaustively may fail to cover the new case. Removing a failure type from a return type is non-breaking.

Deprecation

A deprecated export carries a @deprecated JSDoc tag and is flagged by the companion ESLint plugin at authoring time. There is no runtime deprecation warning. Part of what canc sells is a promise layer cheap enough not to think about, and a console warning on a hot path works against that, especially since it would fire in production code the library cannot fix for you. A deprecated export is removed only at the next major, after carrying the tag for at least one minor.

Compatibility floors

The Node.js and TypeScript requirements are stated as floors, not ranges: node >=18, TypeScript 4.2 and later. Neither has an upper bound. A floor moves only when a package genuinely starts depending on something newer, and raising a floor in a published package is itself a major release, since it can break an install that worked the day before.

The same shape applies to the @cancjs/* peer dependencies each ecosystem package declares on core: a floor such as >=1.0.0 with no ceiling. This lets a package manager collapse everyone's copy of @cancjs/promise down to one, since a narrower range would force duplicates. A floor on a peer still catches the common mismatch, a package that starts calling a core API before the consumer's @cancjs/promise copy is new enough to have it, at install time instead of at runtime.

Keep the ecosystem packages on the same minor

Because ecosystem peer ranges have no upper bound, npm will happily install an old @cancjs/toolbox next to a newer @cancjs/fetch, or the other way around, even across a minor that changed behavior between them. Nothing at install time catches that combination.

The practical guidance: upgrade the @cancjs/* packages you use together, in the same pass, rather than letting them drift apart one at a time. The shared minor line exists to make that easy (every package that changed together ships together), so upgrading as a group is the normal way to consume this tier, not extra caution layered on top of it.

Release notes

Every published package carries its own CHANGELOG.md, generated by changesets from the changeset files authored with each pull request. Every breaking change starts with **Breaking:** and a migration note. A core minor that carries one also opens its changelog entry with a **Breaking:** headline note, so scanning the file top to bottom tells you which minors are safe to take without reading further and which ones are worth a closer look.