storybookjs / frontpage

🌐 The website for storybook.js.org
https://storybook.js.org
MIT License
214 stars 120 forks source link

Append version tag to matched packages in snippets #573

Closed kylegach closed 1 year ago

kylegach commented 1 year ago

Closes #532

See tests for behavior details.

I also made a demo PR, to provide a diff of how the snippets will be changed (when docs are preRelease).

Before

```sh
npx storybook init
npx storybook@next upgrade --prerelease
yarn add -D @storybook/testing-library @storybook/jest @storybook/addon-interactions

npx storybook init

@storybook/testing-library


### After

#### When building _latest_ docs

````md
```sh
npx storybook@latest init
npx storybook@next upgrade --prerelease
yarn add -D @storybook/testing-library @storybook/jest @storybook/addon-interactions

npx storybook@latest init

@storybook/testing-library


#### When building _preRelease_ docs

````md
```sh
npx storybook@next init
npx storybook@next upgrade --prerelease
yarn add -D @storybook/testing-library@next @storybook/jest@next @storybook/addon-interactions@next

npx storybook@next init

@storybook/testing-library

netlify[bot] commented 1 year ago

Deploy Preview for storybook-frontpage ready!

Name Link
Latest commit ff67dbec954430696b19e5f1066100f8e75c429e
Latest deploy log https://app.netlify.com/sites/storybook-frontpage/deploys/64a74b4295004c0008091698
Deploy Preview https://deploy-preview-573--storybook-frontpage.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

kylegach commented 1 year ago

@winkerVSbecks @jonniebigodes — I re-requested reviews from each of you because addressing the comment above required a significant reworking of what you previously approved. This effort is designed to allow us to not think about @latest vs. @next in the docs snippets as graduate/create versions, so a partial solution wouldn't be valuable. Hence, I'm continuing to update this PR instead of merging as it was and improving later.

I now update all relevant snippets in all docs files, not just those in the snippets directory. Additionally, the following behavior has changed:

This PR's description has been updated to reflect this, as has the demo PR to see a diff of resulting changes.

Finally, the recipes are not versioned (i.e. they are always "latest"), so I did not apply this script to those snippets. They all already use @latest appropriately.