|
| 1 | +# ADR-001: Theming peer dependency |
| 2 | + |
| 3 | +2023.04.24 |
| 4 | + |
| 5 | +## Context |
| 6 | + |
| 7 | +Garden provides a collection of React components through multiple NPM packages. |
| 8 | +Each package has peer dependencies for `@zendeskgarden/react-theming`, `react`, |
| 9 | +`react-dom`, and `styled-components`. Typically, a package should increase its |
| 10 | +major version when there is a change in its peer dependency requirements. |
| 11 | +However, Garden proposes a DECISION to deviate from this [general |
| 12 | +rule](https://nodejs.org/en/blog/npm/peer-dependencies) and allow special |
| 13 | +treatment for `@zendeskgarden/react-theming`. |
| 14 | + |
| 15 | +While this decision conflicts with [semantic versioning](https://semver.org/), |
| 16 | +it benefits both maintainers and consumers by enabling a centralized, tested |
| 17 | +collection of hooks and utilities across the codebase. As a result, consumers |
| 18 | +are not required to ingest duplicated and more brittle code. A terminal warning |
| 19 | +will notify the consumer if a peer version is out-of-date. |
| 20 | + |
| 21 | +Ideally, all Garden package versions should align. However, at the very least, |
| 22 | +the `@zendeskgarden/react-theming` peer dependency should align with the highest |
| 23 | +version of a Garden component package dependency. |
| 24 | + |
| 25 | +## Decision |
| 26 | + |
| 27 | +As [centralized theming |
| 28 | +utilities](https://garden.zendesk.com/components/utilities) are added or |
| 29 | +modified (in non-breaking fashion), other Garden component packages may take |
| 30 | +advantage of them by updating their `@zendeskgarden/react-theming` peer dependency |
| 31 | +minor version without publishing a major version breaking change. |
| 32 | + |
| 33 | +## Consequences |
| 34 | + |
| 35 | +If a consumer upgrades a single Garden component package, they may see a console |
| 36 | +warning indicating that the `@zendeskgarden/react-theming` package is |
| 37 | +out-of-date. If the warning is ignored, there is a high likelihood that |
| 38 | +component rendering will fail due to a missing theming utility. However, there |
| 39 | +is no reason to believe that such a failure could slip through to production. |
0 commit comments