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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSF-tools: Parse stories using typescript keywords 'satisfies' and 'as' #23638

Merged
merged 3 commits into from Jul 28, 2023

Conversation

joaonunomota
Copy link
Contributor

Closes #22422

What I did

  • Added if statements to retrieve correct node for story (similar to code for Meta node on line 271 of CsfFile.ts)
  • Added test for parsing stories using typescript as keyword
  • Updated test for parsing stories using typescript satisfies keyword, it was a mislabelled duplicate of the "" test

How to test

  1. Run a sandbox for a typescript template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Update @storybook/csf-tools using yarn build
  3. Update Button.stories.ts with the following:
export const Primary = {
  name: 'Primary (satisfies)',
  args: {
    primary: true,
    label: 'Button',
  },
} satisfies Story;

export const Secondary = {
  name: 'Secondary (as)',
  args: {
    label: 'Button',
  },
} as Story;
  1. Open Storybook in your browser and confirm that they render correctly

image

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]

馃 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@kasperpeulen kasperpeulen added bug patch:yes Bugfix & documentation PR that need to be picked to main branch ci:daily Run the CI jobs that normally run in the daily job. labels Jul 28, 2023
Copy link
Contributor

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me!

@kasperpeulen kasperpeulen self-assigned this Jul 28, 2023
@kasperpeulen kasperpeulen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Jul 28, 2023
@kasperpeulen kasperpeulen changed the title fix: Parse stories using typescript keywords 'satisfies' and 'as' CSF Tools: Parse stories using typescript keywords 'satisfies' and 'as' Jul 28, 2023
@kasperpeulen kasperpeulen changed the title CSF Tools: Parse stories using typescript keywords 'satisfies' and 'as' CSF-tools: Parse stories using typescript keywords 'satisfies' and 'as' Jul 28, 2023
@kasperpeulen kasperpeulen merged commit 39ef76c into storybookjs:next Jul 28, 2023
96 of 103 checks passed
@joaonunomota joaonunomota deleted the story-ts-parse branch July 28, 2023 09:31
@github-actions github-actions bot mentioned this pull request Jul 28, 2023
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ci:daily Run the CI jobs that normally run in the daily job.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: CSF Tools not parsing satisfies stories
2 participants