-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Tags: Add project tags, negation, dev
/autodocs
/test
system tags
#26634
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 2dee030. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
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.
Again, LGTM, but need to see the CSF PR
dev
/docs
/test
system tags
dev
/docs
/test
system tagsdev
/autodocs
/test
system tags
dev
/autodocs
/test
system tagsdev
/autodocs
/test
system tags
const tags = [...(storyAnnotations?.tags || componentAnnotations.tags || []), 'story']; | ||
const defaultTags = ['dev', 'test']; | ||
if (typeof globalThis.DOCS_OPTIONS?.autodocs !== 'undefined') { | ||
once.warn(dedent` |
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.
shouldn't this be a server-side warning in the terminal instead, given that this is a main.js
API getting deprecated?
const id = toId(metaId ?? title, name); | ||
const tags = combineTags(...projectTags, ...(indexInputs[0].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.
I think this reverses the fix you did in #25537
With this change, the autodocs entry will again inherit all the tags from the primary story.
I'm not sure there's a clean workaround for it though.
Closes #21085
Closes #9209
Based on ComponentDriven/csf#80
What I did
Project tags
Added project tags:
This means that we don't need the
docs.autodocs
configuration anymore.autodocs
tag topreview.js
!autodocs
to the story metaautodocs
to preview.js and selectively addautodocs
to the components you want autodocs for.Tag negation
Add the ability to remove tags that have been added higher up in the hierarchy using
!tag
syntax:Updated system tags
Added dev/docs/test system tags
Added new "system" tags
dev
andtest
that automatically get applied to every store (and can be removed with!dev
etc.!dev
removes a story/component from the sidebar!autodocs
removes a story from autodocs!test
removes a story from test runsRemoved story/docs system tags
Storybook was automatically adding the tag
story
to stories anddocs
to docs nodes (autodocs, mdx, etc.).I've removed these, since the use case wasn't clear and since
docs
now means something else per above ☝️Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
docs.autodocs
settings inmain.js
a. That they still work as before
b. That they give a deprecation warning in the browser console and that it makes sense.
docs.autodocs
setting and restarta. no
autodocs
tag is added to.storybook/preview.js
b.
autodocs
tag is added to a component (opt-in case)c.
autodocs
tag is added to.storybook/preview.js
d.
!autodocs
tag is added to a component (opt-out case)d.
!autodocs
tag is added to a story (opt-out case of a story in autodocs)dev
tag. Note that thedev
tag is added globally by default.a. Disable
dev
tag globally by adding!dev
to.storybook/preview.ts
(opt-in case)b. Add
dev
tag to a component and verify that it appears in the sidebarc. Add
!dev
tag to a story within that component and verify that it disappears from the sidebard. Enable
dev
globally by removing!dev
from.storybook/preview.js
e. Add
!dev
to a component and verify that it disappears from the sidebar (opt-out case)test-runner
with--includeTags=test
and verify that only those stories get testedDocumentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 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>