-
Notifications
You must be signed in to change notification settings - Fork 648
docs: add versioning guide #2753
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 3 commits
c2eb7ae
4d71ac8
0a052f8
0af1868
ca3559b
621640b
2b7c947
fa353fd
0800394
37cfd07
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,131 @@ | ||
| # Versioning | ||
|
|
||
| <!-- prettier-ignore-start --> | ||
| <!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
| <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
| ## Table of Contents | ||
|
|
||
| - [Overview](#overview) | ||
| - [Changes](#changes) | ||
| - [Examples](#examples) | ||
| - [A prop is added to a component](#a-prop-is-added-to-a-component) | ||
| - [An existing prop is deprecated](#an-existing-prop-is-deprecated) | ||
| - [The DOM node that an `id` corresponds to is changed](#the-dom-node-that-an-id-corresponds-to-is-changed) | ||
| - [The DOM node that an `aria-label` corresponds to is changed](#the-dom-node-that-an-aria-label-corresponds-to-is-changed) | ||
|
|
||
| <!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
| <!-- prettier-ignore-end --> | ||
|
|
||
| ## Overview | ||
|
|
||
| The Primer team aims to follow | ||
| [Semantic Versioning](https://semver.org/) (semver) for each of the packages | ||
| that we ship. From semver.org, this means that: | ||
|
|
||
| > Given a version number MAJOR.MINOR.PATCH, increment the: | ||
| > | ||
| > 1. **MAJOR** version when you make incompatible API changes, | ||
| > 2. **MINOR** version when you add functionality in a backwards compatible | ||
| > manner, and | ||
| > 3. **PATCH** version when you make backwards compatible bug fixes. | ||
| > | ||
| > _Additional labels for pre-release and build metadata are available as | ||
| > extensions to the MAJOR.MINOR.PATCH format._ | ||
|
|
||
| As a result, whenever you see a `minor` or `patch` update for a package from the | ||
| Primer you should feel confident that you can update without | ||
joshblack marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| anything breaking in your project. For a full list of changes that the team | ||
| commits to being backwards-compatible, view the [changes](#changes) table | ||
| below. | ||
|
||
|
|
||
| ## Changes | ||
|
|
||
| | Category | Type of change | semver bump | | ||
| | :--------- | :------------------------------------------------------------ | :---------- | | ||
| | Component | A component is added | `minor` | | ||
| | | A component is deprecated | `minor` | | ||
joshblack marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | | A component is removed | `major` | | ||
| | Props | A prop is added to a component | `minor` | | ||
| | | The type of a prop is made more general | `minor` | | ||
| | | The type of a prop is made more specific | `major` | | ||
| | | A prop is deprecated | `minor` | | ||
| | | A prop is removed from a component | `major` | | ||
| | | The element to which additional props are added to is changed | | | ||
| | Markup | The DOM node that an `id` corresponds to is changed | | | ||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | | The DOM node that an `aria-label` corresponds to is changed | | | ||
| | | The `role` of a component is changed | | | ||
| | Styles | The `position` of the outermost element is updated | | | ||
| | | The `display` property of the outermost element is updated | | | ||
| | | A flex or grid property is updated | | | ||
| | | A selector is added | | | ||
| | | A selector is removed | | | ||
| | | The specificity of a selector is raised | | | ||
| | | The specificity of a selector is lowered | | | ||
broccolinisoup marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | Behavior | Interactions are added to a component | | | ||
| | | Interactions are removed from a component | | | ||
joshblack marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | TypeScript | A type is added | `minor` | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have any examples of this one in mind? I think this could also be a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really just was thinking of a narrow case where a type has been added to the Public API of the package. In this scenario, I framed it as a Let me know if there is a better way to talk about types in this kind of context, I am honestly not sure how to frame type changes in terms of semver so was just applying a
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah gotcha, thanks for clarifying. I think a type addition that doesn't make a material API change, or something that doesn't require the user to react to can go into a patch. A prominent new feature however, like a new component entirely - which includes new types - would constitute a minor in my mind. I agree that it's nuanced however. Perhaps we can split this up into different type edge cases. |
||
| | | A type is made more general | `minor` | | ||
| | | A type is made more specific | `major` | | ||
| | | A type is removed | `major` | | ||
| | Package | An entrypoint is added to the package | `minor` | | ||
| | | An entrypoint is removed from a package | `major` | | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add a section for
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @broccolinisoup makes sense to me! What kind of situations would be good to place under an
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess things in my mind can certainly go under other categories but maybe explicitly having a section for I was thinking;
Does any of it sound applicable at all? |
||
| ### Examples | ||
broccolinisoup marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #### A prop is added to a component | ||
|
|
||
| semver bump: **minor** | ||
|
|
||
| ```diff | ||
| type Props = { | ||
| propA: string; | ||
| + propB: string; | ||
| }; | ||
|
|
||
| function ExampleComponent({ | ||
| propA, | ||
| + propB, | ||
| }: Props) { | ||
| return ( | ||
| <> | ||
| <span>{propA}</span> | ||
| + <span>{propB}</span> | ||
| </> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| #### An existing prop is deprecated | ||
|
|
||
| semver bump: **minor** | ||
|
|
||
| ```diff | ||
| type Props = { | ||
| propA: string; | ||
| + /** | ||
| + * @deprecated This prop will be removed in the next major version of | ||
joshblack marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| + * `@primer/react`. Please use <replacement> instead. | ||
| + */ | ||
| propB: string; | ||
| }; | ||
|
|
||
| function ExampleComponent({ | ||
| propA, | ||
| + propB, | ||
| }: Props) { | ||
| return ( | ||
| <> | ||
| <span>{propA}</span> | ||
| + <span>{propB}</span> | ||
| </> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| #### The DOM node that an `id` corresponds to is changed | ||
|
|
||
| semver bump: **major** | ||
|
|
||
| #### The DOM node that an `aria-label` corresponds to is changed | ||
|
|
||
| semver bump: **minor** | ||
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.