-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Svelte: Add v5 stories to CLI templates #29382
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit d22b8e9. 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. |
@benmccann could you sanity check my Svelte 5 syntax skills here? |
looks good to me! |
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.
21 file(s) reviewed, 21 comment(s)
Edit PR Review Bot Settings | Greptile
|
||
<button | ||
type="button" | ||
class={['storybook-button', `storybook-button--${size}`].join(' ')} |
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.
style: Use template literal instead of array join for better readability
{#if user} | ||
<span class="welcome"> | ||
Welcome, <b>{user.name}</b>! | ||
</span> | ||
<Button size="small" onClick={onLogout} label="Log out" /> | ||
{:else} | ||
<Button size="small" onClick={onLogin} label="Log in" /> | ||
<Button primary size="small" onClick={onCreateAccount} label="Sign up" /> | ||
{/if} |
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.
style: Consider adding an aria-label to the Button components for better accessibility
|
||
<button | ||
type="button" | ||
class={['storybook-button', `storybook-button--${size}`].join(' ')} |
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.
style: Use template literal for class instead of array join for better performance
77d6297
to
f608e22
Compare
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 for the help @shilman. I tested the canary in Svelte 4 + 5, with TS/JSDoc/JS and everything worked as expected.
I've had to silence some TS errors in our own stories, there's a big risk that our CSF typings for Svelte are slightly incompatible with Svelte 5, but that's not for this PR to solve.
Merging, CI failures are unrelated to this work. |
Svelte: Add v5 stories to CLI templates (cherry picked from commit b370f6a)
Follow-up to #29323
What I did
Added Svelte 5 templates for the usual Button, Header and Page templates, for JS and TS.
Note 1: The
ts-3-8
andts-4-9
directories are identical, in Svelte CSF there's no differenceNote 2: Only the components differ between the JS and TS templates, the story files are identical.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
What I did:
sveltekit-prerelease-ts
sandbox and verify that new stories are added & it runssveltekit-skeleton-ts
sandbox and verify that old stories are added & it runsDocumentation
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 pull request has been released as version
0.0.0-pr-29382-sha-f608e224
. Try it out in a new sandbox by runningnpx [email protected] sandbox
or in an existing project withnpx [email protected] upgrade
.More information
0.0.0-pr-29382-sha-f608e224
svelte-5-stories
f608e224
1729167419
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=29382
Greptile Summary
This PR adds Svelte 5 story templates to the Storybook CLI, including new Button, Header, and Page components for both JavaScript and TypeScript.
code/renderers/svelte/template/cli
for JS and TScode/core/src/cli/helpers.ts
to support Svelte 5 template selectioncode/lib/create-storybook/src/generators/SVELTE/index.ts
for simplified Svelte version detectioncode/package.json
$props()
and$state
syntax usage in Svelte 5 components