|
| 1 | +# ADR 010: Merge drafts status into experimental |
| 2 | + |
| 3 | +## Status |
| 4 | + |
| 5 | +Draft |
| 6 | + |
| 7 | +## Context |
| 8 | + |
| 9 | +`Drafts` were introduced in [ADR-006](./adrs/adr-006-drafts.md) as a way of creating components outside of the root bundle of `@primer/react`. This helps us create, test and maintain multiple versions of the same component in parallel. |
| 10 | + |
| 11 | +Example: |
| 12 | + |
| 13 | +```js |
| 14 | +// default version of component exported from root of package |
| 15 | +import {UnderlineNav} from '@primer/react' |
| 16 | + |
| 17 | +// new version of component exported from /drafts |
| 18 | +import {UnderlineNav} from '@primer/react/drafts' |
| 19 | +``` |
| 20 | + |
| 21 | +We have also used this method for components that are still a work in progress and we don't want developers to start using them in production without collaborating with us first. |
| 22 | + |
| 23 | +Example: |
| 24 | + |
| 25 | +```js |
| 26 | +// this component only exists in drafts and not in the roof of the package |
| 27 | +import {TreeView} from '@primer/react/drafts' |
| 28 | +``` |
| 29 | + |
| 30 | +### Why do we not reuse `experimental` status? |
| 31 | + |
| 32 | +The reason we do not use `experimental` label for these components is because `drafts` conveys a different message than maturity on the [component lifecycle](https://primer.style/contribute/component-lifecycle). |
| 33 | + |
| 34 | +A `draft` component can be further along on the component lifecycle than `experimental`, but still not be the recommended version of the component until the next major release (to plan breaking changes better). For example, at the time of writing, the [new UnderlineNav2 in drafts](https://primer.style/react/drafts/UnderlineNav2) has been reviewed for accessibility and is almost at `Beta` maturity. We can call it a `draft` component with `beta` maturity. |
| 35 | + |
| 36 | +### Problem |
| 37 | + |
| 38 | +This is very confusing. While the above separation is useful for maintainers of primer, it is less useful to consumers. |
| 39 | + |
| 40 | +1. Consumers of primer are often confused to not find `draft` maturity on the component lifecycle. |
| 41 | +2. It is similar to `experimental` label in the most important characteristic to consumers - The component is not ready for production usage. |
| 42 | + |
| 43 | +### Decision |
| 44 | + |
| 45 | +We should drop the `draft` label and use `experimental` instead. |
| 46 | + |
| 47 | +While not completely accurate (UnderlineNav2 is much more polished than `experimental` maturity), the lack of confusion makes it a good trade-off. |
| 48 | + |
| 49 | +Fine-grained information about component maturity, useful for maintainers, is also communicated by the [status checklist in the component documentation](https://primer.style/react/drafts/UnderlineNav2#status). |
| 50 | + |
| 51 | +### Side effects |
| 52 | + |
| 53 | +We should create a new parallel import path for `@primer/react/experimental`. |
| 54 | + |
| 55 | +```diff |
| 56 | +// new version of component exported from /experimental |
| 57 | +- import { UnderlineNav } from '@primer/react/drafts' |
| 58 | ++ import { UnderlineNav } from '@primer/react/experimental' |
| 59 | +``` |
| 60 | + |
| 61 | +We would need to keep `@primer/react/drafts` in the short term as well for backwards compatibility. |
0 commit comments