-
Notifications
You must be signed in to change notification settings - Fork 648
Create deprecating-components.md #2733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
aac770b
5ee2013
a05470e
d857286
be4d425
56b0650
2811c88
e97505e
e6b6bb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,78 @@ | ||||||
| As we work on the maturity of our components, we will sometimes need to build components in a parallel track/bundle without breaking existing components. Eventually, the new components would replace the old ones in the main bundle and this document explains the process around it. | ||||||
|
|
||||||
| ## Developing a draft component | ||||||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| Start building the new component outside of the main bundle. This includes the source code of the component being under the `src/drafts` folder and the component being exported in the draft bundle (`src/drafts/index.ts`). That way, folks who | ||||||
|
||||||
| who would like to try the draft version of the component can export it from the draft bundle. | ||||||
|
|
||||||
| ``` | ||||||
| import { ActionList } from "@primer/react/drafts" | ||||||
| ``` | ||||||
|
|
||||||
| If it is a 1:1 replacement, it's useful to keep the component name the same for consumers. Internally, we would want to, for example, call the folder name `ActionList2` and call the docs `ActionMenu v2`. | ||||||
|
|
||||||
| ## Deprecating the component | ||||||
|
|
||||||
| Once the component is ready to be graduated from the drafts bundle to the main one, we first plan to see in which major release the component will go into deprecation and prepare for the code changes and the communications around it. | ||||||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ### Code side of the deprecation | ||||||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| Here is a checklist for developers to smoothen the deprecation process. | ||||||
|
|
||||||
| #### Source Code | ||||||
|
|
||||||
| - [ ] Move the old component's source code under the `src/deprecated` folder. | ||||||
| - [ ] Remove the old component export in the main bundle to be added to the deprecated one. | ||||||
| - [ ] Export the old component in the deprecated bundle `src/deprecated/index.ts`. | ||||||
| - [ ] Rename the new component to its neutral version if it includes `2` or `v2`. I.e. `ActionList2` -> `ActionList`. | ||||||
| - [ ] Move the new component's source code to the `src` folder if it is under `src/drafts`. | ||||||
| - [ ] Export the new component in the main bundle `src/index.ts`. | ||||||
|
|
||||||
| #### Storybook | ||||||
|
|
||||||
| - [ ] Update the new component's storybook title from `Drafts/Components/<Component-Name>` to `Components/<Component-Name>`. | ||||||
| - [ ] Move the old component's stories under `src/stories/deprecated`. | ||||||
|
|
||||||
| #### Tests | ||||||
|
|
||||||
| - [ ] Move the old component's tests under `src/__tests__/deprecated`. | ||||||
| - [ ] Update `script/generate-e2e-tests.js` to reflect the new component's component ID is generated by the storybook title. | ||||||
| - [ ] Update the snapshots using the command `npm run test -- -u`. | ||||||
|
|
||||||
| #### Docs | ||||||
|
|
||||||
| - [ ] Move the deprecated component's docs to the `src/docs/deprecated` folder and update the title by adding `(legacy)`, status as well as the storybook and the source code link. | ||||||
| - [ ] Make sure to update `jsx live` -> `jsx live deprecated` | ||||||
| - [ ] Make sure to update the import code block. I.e. `import { ActionList } from "@primer/react/deprecated"`. | ||||||
| - [ ] Add a `Deprecation` section with the link of the newly developed component and provide a diff. See [deprecated ActionList docs](https://primer.style/react/deprecated/ActionList#deprecation) as an example. | ||||||
| - [ ] Move the new components docs from draft folder to the main docs folder `docs/content/` and update the title by removing `v2`, status as well as the storybook and the source code link. | ||||||
| - [ ] Make sure to update `jsx live drafts` -> `jsx live` | ||||||
| - [ ] Make sure to update the import code block. I.e. `import { ActionList } from "@primer/react"`. | ||||||
| - [ ] Update the navigation on `docs/src/@primer/gatsby-theme-doctocat/nav.yml` accordingly. | ||||||
|
|
||||||
| ### Comms side of the deprecation | ||||||
|
|
||||||
| When we know if the newly developed component is ready to go in the main bundle and the old component is good to be deprecates in the next major release, we announce the deprecation and the promotion in the Primer changelog under the `Coming soon` section. | ||||||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| Once the major release is out, we provide support on how to switch using the newly develop component as well as how to continue to use the deprecated component for folks who prefer to migrate later on. | ||||||
|
|
||||||
| We also write codemods to deprecate the old component and use the new component under [our migration repo](https://github.com/primer/react-migrate#readme). | ||||||
|
||||||
|
|
||||||
| ### Accessibility Scorecards | ||||||
lesliecdubs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| As teams begin to adopt the [Accessibility scorecard](https://github.com/github/engineering/discussions/2443), we have an opportunity to encourage teams to update/remove deprecated components and adopt new ones. | ||||||
|
|
||||||
| To get these items on the scorecard, we should be reaching out to #accessibility: | ||||||
|
|
||||||
| - When we deprecate a component | ||||||
| - When we release a new component that we want to enforce usage around | ||||||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| ## Removing the deprecated component | ||||||
|
|
||||||
| After about 6 months of living in the deprecated bundle, a component is retired/deleted from the codebase. This is also a breaking change and we release it in the upcoming major release. | ||||||
| At this point, consumers are expected to plan migration work and we annouce the deletion in Primer Changelog as we do for the deprecation. | ||||||
|
|
||||||
| ## FAQ | ||||||
|
|
||||||
| - Does the deprecated component accept new feature request? | ||||||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| - No, because we have a single bundle for all components, you can not pick the components you want to upgrade. This can result in additional unrelated work. | ||||||
|
||||||
| - No, because we have a single bundle for all components, you can not pick the components you want to upgrade. This can result in additional unrelated work. | |
| - No, once a component is deprecated the only changes it will receive are bug fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do y'all think: should this be will receive or may receive? Not sure how dedicated we've been to handling all bugfixes in deprecated components, or just major functional bugs 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"may receive" sounds good to me. I like that it removes the certainty.
I updated to be "may receive" but please let me know if anyone has a concern 🙌🏻
Uh oh!
There was an error while loading. Please reload this page.