What you'll learn: By the end of this lesson you will be able to set contribution criteria for a shared component library, decide whether a change is a patch, a minor or a major release under Semantic Versioning, run a deprecation as a sequence of releases rather than a surprise, and explain what a changelog, a warning and a migration path each have to say to the teams that depend on you.
Think of the signs on a shared office kitchen. "The dishwasher is emptied by whoever opens it" is a rule. Someone decides it, people can find it, and when it changes there is a note on the door. Without those three things you do not have a rule, you have an argument on the third Friday of every month.
A shared UI library has the same problem at a larger scale. Ten apps depend on it. Every change helps some apps and risks others, and the teams that own the apps are not in the room when the change is made. Governance is the set of decisions about who may change what, and versioning is how those changes are announced in a form that tools and people can both read.
The running example is the storefront library from the previous lesson, Component Library Architecture: a Button and a Tabs, used by a product page, a checkout and an account app. The numbers in the scenarios are illustrative.
The core idea
- A version number is a promise about compatibility. Semantic Versioning says a version takes the form
MAJOR.MINOR.PATCH, that the software "MUST declare a public API", and that the number changes according to what happens to that API. If the promise is broken, consumers stop trusting upgrades, and a library nobody upgrades is a library with many versions in production. - Removal is the last step of a process, not the first. The Semantic Versioning FAQ advises documenting a deprecation, releasing it in a minor version, and removing the feature only in a later major release.
- Governance is mostly about saying no in a way people can predict. Written criteria let a contributor know before writing code whether a component will be accepted.
Who decides: contribution criteria
A library with no process grows by whoever shouted last. One public example of a written process is the GOV.UK Design System's contribution criteria. To propose a new component or pattern there must be evidence it would help many teams (useful) and that it does not replicate something already there (unique). Before publication it must be shown to work with a representative sample of users, including disabled users (usable); reuse existing styles and follow the system's standards (consistent); be versatile enough for a range of services; and be tested across browsers, assistive technologies and devices.
You do not have to copy those criteria. You do need an answer, written down, to the same questions, and a person who applies it.
Illustration 1 (minimal): three requests, one rulebook. An app team asks for a Rating component because the product page needs stars. A second team wants a ProductCard because it is used in two places. A third wants a new border radius for the checkout only. Under the criteria above: Rating is accepted only if other teams show a need (useful) and nothing existing covers it (unique); ProductCard is a product pattern of the storefront rather than a general-purpose component, so it may belong in the app; the radius fails the versatile test unless it becomes a design token change for everyone. The rulebook does not make the decision easy. It makes it explainable.
Figure 1. From a request to a release
How to read this: a request has two outcomes, and the second one is a normal outcome. A declined request returns to the app that asked, with a reason.
Naming the owners
A library with no named owner decays. These roles are one common arrangement and are an opinion, not a standard:
| Role | Decides | Does not decide |
|---|---|---|
| Library team | What is accepted, the release schedule, the support policy | How an app uses a component |
| Contributors (app teams) | The proposal, the implementation, a migration for their own app | Whether it is accepted |
| Consumers (all apps) | When to upgrade within the support policy | The API |
The support policy is the part teams skip. State how many major versions you maintain, how long a deprecation lasts, and how fast security fixes are released. Those are your numbers to choose, and they belong in the documentation, because "supported" is a promise too.
Which bump is it?
Semantic Versioning defines the three bumps in terms of the public API. A patch is for backward compatible bug fixes. A minor is for backward compatible new functionality, and "MUST be incremented if any public API functionality is marked as deprecated". A major is for backward incompatible changes. Version 0.y.z is for initial development, when "Anything MAY change at any time".
For a component library the public API is bigger than the types. It includes the exported names and props (the surface test in the previous lesson checks them), the behaviour a caller can observe (which key moves focus), and the elements and class names that other code depends on. That last group is a judgement. Whether a visual change is a break is a decision for the library team to make and document; the specification only says that the API must be declared.
Figure 2. Choosing the bump
or breaks documented behaviour?"} Q1 -->|"yes"| MAJ["MAJOR"] Q1 -->|"no"| Q2{"Adds functionality,
or deprecates something?"} Q2 -->|"yes"| MIN["MINOR"] Q2 -->|"no"| PAT["PATCH: a bug fix only"]
How to read this: the questions run from the most serious outcome down. A change that fits the first question is a major release even if it also does other things.
Illustration 2 (realistic): sorting a real changelog. Four changes land in one week:
| Change | Bump | Why |
|---|---|---|
Add an optional loading prop to Button |
Minor | New functionality, existing code still works |
Fix Tabs so End focuses the last tab |
Patch | A bug fix that matches the documented behaviour |
Mark Button's danger boolean as deprecated in favour of variant="danger" |
Minor | The spec asks for a minor release for a deprecation |
Remove the danger boolean |
Major | Existing callers stop working |
The fix to Tabs is the interesting one. If apps had relied on End doing nothing (for instance by handling it themselves), the fix changes behaviour they can see. Calling it a patch is defensible if the behaviour is documented, and it is a reason to read the pull request description for apps that override keys.
Deprecation is a process
Deprecation means "this still works, and it will stop working". It only helps if the consumer finds out in time and has a way to move.
Three channels carry the message, and a good deprecation uses more than one:
- The documentation and changelog. The Node.js project describes this as a documentation-only deprecation: stated in the docs, with no side effects at run time.
- A warning where the consumer will see it. Node.js has runtime deprecations that emit a warning, and an end-of-life stage for functionality that is or will soon be removed. For a package,
npm deprecateprints a message to the terminal when a user installs a deprecated package or version, and npm strongly recommends deprecating over unpublishing, because unpublishing removes the package for everyone who depends on it. A library can do the same in its own code, such as a development-only console warning when a deprecated prop is used. - A migration path. React gives an example of the pattern. In React 19
refis a prop of function components,forwardRefis no longer needed for new components, React says it will be deprecated and removed in future versions, and a codemod will be published to update existing components. The old way keeps working while the new way is offered and the tool is prepared.
Figure 3. The life of a component or prop
How to read this: only the Experimental stage can be dropped without a major release, which is exactly what the label promises.
Pre-release versions help here. Semantic Versioning says a pre-release such as 1.0.0-alpha ranks below the normal version and "indicates that the version is unstable", and that once a version is released its contents "MUST NOT be modified", so a fix is a new version.
Figure 4. A deprecation across three releases
How to read this: the library team does not remove the old prop until it knows who still uses it. Knowing that needs a way to see usage, which the next section covers.
Knowing who uses what
You cannot govern what you cannot see. Useful questions, none of which need special tools to ask:
- Which version of the library does each app run?
- Which deprecated names does each app still use?
- Which apps are more than one major version behind?
A search across the apps' repositories answers the second question for a rename. In a monorepo it is one search; across repositories it needs an inventory someone keeps. Without it a major release is a guess about who will break.
Build it
There is no lab for this lesson: governance is decisions and process, and a toy program would add nothing. The previous lesson's lab (component-library-core) gives you the one technical piece, a surface test that lists the exported names, which is the file a reviewer reads to classify a pull request.
A paper exercise in place of a lab:
- Take the lab's
src/index.tsand write three changes to it: add an export, rename an export, and change a prop's default. - For each, use Figure 2 to pick the bump and write the changelog line a consumer would need.
- For the rename, write the three-release deprecation plan of Figure 4 with dates.
Trade-offs
| Choice | Gain | Cost |
|---|---|---|
| Strict criteria for new components | A small, coherent library | Teams build their own and drift |
| Long deprecation window | Apps migrate on their own schedule | Two ways to do one thing for longer |
| Frequent major releases | Small, clear breaks | Apps fall behind and carry old versions |
| Rare major releases | Calm upgrades | Larger breaks, and old APIs linger |
| A runtime warning for deprecations | Developers see it | Noise if a library warns too often |
In practice: a patch that changed a default
This is a realistic scenario, not a case history. It is a composite built from common production patterns. It describes no specific company or product, and every number in it is an illustrative assumption.
The situation
The library team notices that most buttons use the large size and changes the Button default from md to lg. It is a one-line change with no new prop, and the team releases it as a patch. The product page absorbs it. Checkout lays out three buttons in a row, and with the new default they wrap onto a second line on narrow screens.
Starting architecture
Figure 5. Starting point: three apps, three versions, no inventory
How to read this: checkout accepts new patch and minor versions automatically, so a change labelled as a patch reaches it without anyone choosing to upgrade.
Options considered
| Option | What it fixes | What it costs | Risk |
|---|---|---|---|
| Revert the default and re-release | Checkout is fixed | Product page sees the opposite change | Another surprise for apps that already adjusted |
Keep the default, tell checkout to set size="md" |
The library team's goal | A fix in every app that relied on the default | A major-sized change shipped as a patch again |
| Revert, then release the new default in a major version with a changelog | The promise stays true | The goal is delayed | Slower |
The decision
| Field | Decision record |
|---|---|
| Context | A default is part of what callers observe, and apps range-install patches. |
| Decision | Revert in a patch. Define in the policy that a changed default, visual or behavioural, is a major change. Offer the new default first as an opt-in value, then switch it in the next major release. |
| Consequences, good | The version number matches the risk again, and apps can upgrade without a visual review for patches. |
| Consequences, bad | The change the library team wanted takes longer to ship. |
| Revisit when | A visual regression test can catch layout changes in consuming apps, which would let the policy relax. |
Rollout and verification
- Revert and release with a changelog line that names the cause.
- Write the policy sentence about defaults and link it from the pull request template.
- Add a review question to every change: "would an app see a difference without changing its code?"
The 2 a.m. failure
Illustration 3 (failure): Customer support reports that the checkout button row is broken on small phones, and the checkout team reports no deploy that day. The only change was a lockfile refresh in the nightly build, which pulled in the library patch (illustrative). Nobody connects the two for hours because the changelog says only "improved default button size".
First three checks: (1) diff the lockfile between the last good build and the current one; (2) read the changelog of every package that changed; (3) install the previous library version and reproduce. Mitigation: pin the library to the previous version in checkout and redeploy. Follow-up: require changelog lines to say what an app will notice, and review how apps take patch updates.
Architect's notes
- Write the public API down before you promise anything. Include behaviour and defaults, not only names.
- A default is an API. Treat a change to one as breaking unless you have decided otherwise in writing.
- Deprecate with a replacement in hand, and a tool or a guide for the move.
- Say how long you support what. The numbers are yours to choose, and teams plan around them.
- Keep an inventory of consumers, even a simple one.
Common mistakes
- Releasing a visual or behavioural break as a patch.
- Removing in the same release that deprecates, which is just a removal.
- A changelog that describes the code, not what an app will notice.
- Staying at
0.y.zfor years, which tells consumers that anything may change at any time. - Unpublishing a bad version instead of deprecating it and releasing a fix.
Key takeaways
- A version number is a promise about the declared public API.
- A patch fixes bugs compatibly; a minor adds functionality or deprecates; a major breaks.
- Deprecate first, remove later: documentation, a warning and a migration path.
- Written contribution criteria make declined requests explainable.
- Defaults, behaviour and element structure may belong to your API: decide and document.
- You cannot govern what you cannot see: know who runs which version.
Practice exercises
Exercise 1 — Starter (30 min): Classify these as patch, minor or major and justify each: a new Badge component; Tabs renaming label to aria-label; a fix for a focus bug; a new default for size.
Exercise 2 — Intermediate (2 hours): Write a one-page support policy for a library: majors supported, deprecation period, how security fixes are announced. State which of your choices you would revisit first, and why.
Exercise 3 — Advanced (half day): Plan the removal of a widely used prop across five apps: the releases, the warning text, the changelog lines, the usage inventory and what you would do about an app that has not moved by the deadline.
Related reading
In this course:
- Component Composition and API Design, shaping the props you will later have to version.
- API Contract Evolution for Clients, the same compatibility questions between an API and its callers.
- Monorepos and Shared Libraries, where shared packages and their consumers live.
- Independent Deployment and Shared Dependencies, what happens when apps upgrade at different times.
Official documentation
- Semantic Versioning 2.0.0, the specification and its FAQ.
- npm: Deprecating and undeprecating packages or package versions.
- Node.js: Deprecations, the kinds of deprecation.
- GOV.UK Design System: Contribution criteria.
- React 19 release post,
refas a prop and the plan forforwardRef.