Skip to content

Commit

Permalink
docs: deprecation steps update (#2528)
Browse files Browse the repository at this point in the history
  • Loading branch information
castastrophe authored Feb 15, 2024
1 parent 662aadb commit 7617146
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions .storybook/guides/deprecation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,43 @@ When a component is deprecated, it is no longer recommended for use. Though the
If you have any questions or concerns about this deprecation, please feel free to contribute to the discussion here or reach out to us directly.
```

### Storybook

- Create a new folder with the component name in `.storybook/deprecated`, i.e., `.storybook/deprecated/quickaction`.
- Copy `*.stories.js` and `metadata/*.yml` into the new folder (directly, not nested inside subfolders).
- Open up and edit the title of the `*.stories.js` default export to be prefixed with the `Deprecated` category, i.e., `title: "Deprecated/Quick actions"`.
- Update any local references to point to the package name instead, i.e.,<br/>_Original_:<br/>`import { Template } from "./template";`<br/><br/>_Updated to_:<br/>`import { Template } from "@spectrum-css/quickaction/stories/template.js";`.
- In the parameters section of the `*.stories.js`, there are 2 important updates to make:
- Add `chromatic: { disable: true },` to ensure it no longer runs regression tests.
- Update the `status` type to `deprecated`:
```json
parameters: {
chromatic: { disable: true },
status: { type: "deprecated" }
},
```

### Documentation

Update the status of the component to `Deprecated` in the `*.yml` file. Add any additional migration notes to the `deprecationNotice` keyword. i.e.,
### Flagging the component as deprecated

Before removing the component from the codebase, we need to flag the component as deprecated and publish those changes to the package registry. This will allow downstream consumers to see that the component is being deprecated and provide them with the deprecation notice and migration path. It will also provide a foundation for removal of the component from the codebase without breaking local references.

1. Create a new branch for the deprecation. i.e., `git checkout -b deprecate-quickaction`.
2. Open up any `*.stories.js` files inside the component's folder:
a. Edit the title of any exported stories to be prefixed with the `Deprecated` category, i.e., `title: "Deprecated/Quick actions"`.
b. Update any local references to point to the package name instead, i.e.,<br/>_Original_:<br/>`import { Template } from "./template";`<br/><br/>_Updated to_:<br/>`import { Template } from "@spectrum-css/quickaction/stories/template.js";`.
c. In the parameters section, there are 2 important updates to make:
- Add `chromatic: { disable: true },` to ensure it no longer runs regression tests.
- Update the `status` type to `deprecated`:
```json
parameters: {
chromatic: { disable: true },
status: { type: "deprecated" }
},
```
3. Update the status of the component to `Deprecated` in the `*.yml` file. Add any additional migration notes to the `deprecationNotice` keyword. i.e.,
```yaml
name: Quick actions
status: Deprecated
deprecationNotice: Use an <a href="actionbar.html">action bar</a> to allow users to perform actions on either a single or multiple items at the same time, instead.
```
4. Commit these changes and open a pull request to the main branch. i.e., `git commit -m "chore(quickaction): prepare for deprecation"`.
5. Once the pull request is approved, merge the changes into the main branch and publish the update to the package registry.

### Codebase
At this point you can choose to either immediate move on to the next steps or give a preset amount of time for feedback and concerns to be raised. If you choose to wait, make sure to communicate the timeline to the Spectrum Web Components team and downstream consumers.

- Delete the package from the components directory.
- Add the deprecated component's package and last version to the root package.json. i.e., `"@spectrum-css/quickaction": "^3.1.1",`.
- Reach out to one of the package maintainers to officially deprecate the package in the package registry with the provided deprecation notice from design. Do not try to run the deprecation command unless you know that you have publishing permissions on npm. i.e., `npm deprecate @spectrum-css/[email protected] "This package has been deprecated. Use an action bar to allow users to perform actions on either a single or multiple items at the same time, instead."`.
### Removal from the monorepo

Once the deprecation notice has been communicated and the above steps completed, we can remove the component from the codebase safely without breaking local references.

1. Create a new folder with the component name in `.storybook/deprecated`, i.e., `.storybook/deprecated/quickaction`.
2. Copy `*.stories.js` and `metadata/*.yml` into the new folder (directly, not nested inside subfolders).
3. Delete the package from the `components` directory.
4. Add the deprecated component's package and last version to the monorepo's root package.json. i.e., `"@spectrum-css/quickaction": "^3.1.1",`.
5. Reach out to one of the package maintainers to officially deprecate the package in the package registry with the provided deprecation notice from design. Do not try to run the deprecation command unless you know that you have publishing permissions on npm. i.e., `npm deprecate @spectrum-css/[email protected] "This package has been deprecated. Use an action bar to allow users to perform actions on either a single or multiple items at the same time, instead."`.

### Post-deprecation communication

Expand Down

0 comments on commit 7617146

Please sign in to comment.