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

Support importing stories from separate packages #339

Merged
merged 3 commits into from
Aug 3, 2023

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Aug 2, 2023

Closes #133

This PR adds a fix that aims to provide support for importing stories from separate packages such as is commonly done in monorepos:

e.g. this project structure:

repo/
-- app
---- stories
------ button.stories.ts
-- storybook
---- .storybook
------ main.ts

and this storybook config file:

export default {
  // I am pointing to stories from another app!
  stories: ['../../app/stories/*.stories.*']
}
📦 Published PR as canary version: 0.12.1--canary.339.90fb7b2.0

✨ Test out this PR locally via:

npm install @storybook/test-runner@0.12.1--canary.339.90fb7b2.0
# or 
yarn add @storybook/test-runner@0.12.1--canary.339.90fb7b2.0

Version

Published prerelease version: v0.13.0-next.0

Changelog

🚀 Enhancement

  • Support importing stories from separate packages #339 (@yannbf)

Authors: 1

@yannbf yannbf added the patch Increment the patch version when merged label Aug 2, 2023
@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (ec98a54) 77.17% compared to head (90fb7b2) 77.17%.
Report is 9 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next     #339   +/-   ##
=======================================
  Coverage   77.17%   77.17%           
=======================================
  Files          11       11           
  Lines         184      184           
  Branches       39       39           
=======================================
  Hits          142      142           
  Misses         42       42           
Files Changed Coverage Δ
src/util/getStorybookMetadata.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yannbf yannbf force-pushed the feat/multiple-roots-monorepo branch from 6f8f876 to 917655f Compare August 2, 2023 12:59
@yannbf yannbf force-pushed the feat/multiple-roots-monorepo branch from 917655f to 848d743 Compare August 2, 2023 13:03
@yannbf yannbf changed the title add multiple roots if main.js points to external projects Support importing stories from separate packages Aug 2, 2023
@yannbf yannbf force-pushed the feat/multiple-roots-monorepo branch from a1fbdb1 to 8a745f5 Compare August 3, 2023 13:34
@yannbf yannbf added minor Increment the minor version when merged and removed patch Increment the patch version when merged labels Aug 3, 2023
@yannbf yannbf merged commit 6dc3a4e into next Aug 3, 2023
14 checks passed
@yannbf yannbf mentioned this pull request Aug 4, 2023
@github-actions
Copy link

github-actions bot commented Aug 4, 2023

🚀 PR was released in v0.13.0 🚀

@ValeFranchi
Copy link

Does this fix the coverage collection too? so if i have a monorepo with stories in each package, it will collect the coverage from the files in each package?

@yannbf
Copy link
Member Author

yannbf commented Nov 24, 2023

Does this fix the coverage collection too? so if i have a monorepo with stories in each package, it will collect the coverage from the files in each package?

Hey there, great question! It could probably fix it, but it also depends on how the file inclusion is done in the coverage addon in combination with your repo structure. Could you please try it out and open an issue with a reproduction in case it won't work? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] generated testMatch assumes Storybook working dir matches Jest rootDir
3 participants