-
Notifications
You must be signed in to change notification settings - Fork 321
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
docs: allow having Internal section with stories only visible for dev mode #2062
docs: allow having Internal section with stories only visible for dev mode #2062
Conversation
packages/core/.storybook/manager.jsx
Outdated
} | ||
} | ||
}); | ||
|
||
function filterInternalStoryDocsPage(item) { | ||
return process.env.STORYBOOK_ENV === "development" || !item.tags?.includes?.("internal"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we filter the entire section without the tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically, we can say that if the name includes Internal.
I could add it as an extra check, and leave the current, just for cases where if we would like to have an internal story inside an existing category. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should work also with internals stories, no? Anyway I think it's fine for now with tags. It's a new feature in SB7 no? We can use them for the beta/deprecated tags as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- yep it is
- you mean adding styled tags?
- and if I remove the check for
tags
and only exclude theInternal
category, then it won't exclude internal stories that are inside regular (exported) categories
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I mean the sidebar tags, we use the name to decide whether a story is a beta or deprecated, I think using tags is better for that purpose. Let's stay with tags, forget about what I said 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh I got you
TechDebt task 🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages/core/.storybook/manager.jsx
Outdated
} | ||
} | ||
}); | ||
|
||
function filterInternalStoryDocsPage(item) { | ||
return process.env.STORYBOOK_ENV === "development" || !item.tags?.includes?.("internal"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storybook uses env variables, I think you can get them somehow here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to also use their support, and their docs, couldn't find anything related
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would love to know if you find something, I'll change it 🙏🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use process.env.NODE_ENV
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are they setting it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes tried it locally also, and they use production
for build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do they supply in dev
?
I'm not sure if we're exporting as production build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, just remove the console
packages/core/.storybook/manager.jsx
Outdated
} | ||
} | ||
}); | ||
|
||
function filterStory(item) { | ||
console.log(process.env.NODE_ENV === "development", item.title, ...item.tags, { item }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
https://monday.monday.com/boards/3532714909/pulses/6437258196