-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Controls: Added server channel to create a new story #26769
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 154a302. 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 1 targetSent with 💌 from NxCloud. |
74fbb39
to
5483520
Compare
cb5ef4d
to
23fce6f
Compare
ba0a512
to
83f2b9f
Compare
83f2b9f
to
bc96f39
Compare
code/lib/core-server/src/server-channel/create-new-story-channel.ts
Outdated
Show resolved
Hide resolved
code/lib/core-server/src/server-channel/create-new-story-channel.ts
Outdated
Show resolved
Hide resolved
code/lib/core-server/src/utils/new-story-templates/typescript.ts
Outdated
Show resolved
Hide resolved
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}" |
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.
Missing a newline at end-of-file.
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.
This also falls into the (opinionated) formatting preferences of the user. As elaborated earlier, we don't have a proper solution in place to format the file by using the user's formatter and formatting rules.
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 still don't like the generic Component
name for default imports, but otherwise this looks good.
|
||
expect(exportedStoryName).toBe('Default'); | ||
expect(storyFileContent).toMatchInlineSnapshot(` | ||
"import Component from './Page'; |
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.
Oh, I thought componentExportName
would be the file's base name if there is no named export. That's what the test above suggested. Either way, can we use the file's base name (converted to PascalCase) rather than Component
?
55e8a43
to
1c12bc0
Compare
Closes #26658
What I did
This PR registers a server channel backend side to listen to 'create-new-storyfile' events for creating new story files. The payload for the creation looks like this:
As soon as the new story file is created the result event 'create-new-storyfile-result' is emitted with the following payload:
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
yarn task --task sandbox --start-from auto --template react-vite/default-ts
src/stories/Button.stories.ts
and adjust the meta section like this:sandbox/ButtonExample
gets created.Documentation
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>