Skip to content
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

Update Storybook to latest version #2026

Closed
wants to merge 2 commits into from
Closed

Conversation

witoszekdev
Copy link
Member

I want to merge this change because it updates Storybook to latest version. This includes many benefits like faster build times.

PR intended to be tested with API branch:

Screenshots

Pull Request Checklist

  1. This code contains UI changes
  2. All visible strings are translated with proper context including data-formatting
  3. Attributes [data-test-id] are added for new elements
  4. Changes are mentioned in the changelog
  5. The changes are tested in different browsers and in light/dark mode

Test environment config

API_URI=https://automation-dashboard.staging.saleor.cloud/graphql/

@witoszekdev
Copy link
Member Author

witoszekdev commented Apr 28, 2022

I've run codemod to migrate every story to CSF format instead of storiesOf.
Unfortunately Storybooks codemod build is broken so I needed to do some hacks to make it work:
Documentation in case we'd need old codemods from Storybook again

  • Clone Storybook repo locally
  • Change file name in @storybook/codemods package src/transforms/storiesof-to-csf.js -> src/transforms/storiesof-to-csf.ts
  • Add // @ts-nocheck at the top of the file to disable TypeScript errors
  • Install Storybook dependencies according to their documentation in README
  • Build @storybook/codemods package using yarn workspace @storybook/codemods prepare
  • Get list of all Storybook files using this neat little script
import fs from "fs";
import { globby } from "globby";

const files = await globby("**/*.stories.{ts,tsx}");

fs.writeFile("out.txt", files.join("\n"), err => console.log(err));
./node_modules/.bin/jscodeshift --trace-warnings -t <STORYBOOK_REPO_DIRECTORY>/lib/codemod/dist/cjs/transforms/storiesof-to-csf.js --verbose=2 --run-in-band --parser=tsx --no-babel --stdin < out.txt

The files should be changed 🥳

@stale
Copy link

stale bot commented Dec 6, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 6, 2022
@stale stale bot closed this Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant