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

SvelteKit: Introduce portable stories support #28918

Merged
merged 4 commits into from
Aug 19, 2024

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Aug 19, 2024

Closes #28892

What I did

This PR introduces the ability to use SvelteKit in portable stories, therefore being able to use the Vitest addon plugin with it.

For that, you must configure the plugin that comes in the vite export of sveltekit:

import { defineWorkspace, defaultExclude } from "vitest/config";
import { storybookTest } from "@storybook/experimental-addon-vitest/plugin";
import { storybookSveltekitPlugin } from "@storybook/sveltekit/vite";

export default defineWorkspace([
  {
    extends: "vite.config.ts",
    plugins: [
      storybookTest({
        storybookScript: "yarn storybook --ci",
      }),
      storybookSveltekitPlugin(),
    ],
})

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/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>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 76.3 MB 76.3 MB 0 B -0.71 0%
initSize 169 MB 169 MB 0 B -0.71 0%
diffSize 92.7 MB 92.7 MB 0 B 0.71 0%
buildSize 7.46 MB 7.46 MB 0 B 0.71 0%
buildSbAddonsSize 1.61 MB 1.61 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.3 MB 2.3 MB 0 B - 0%
buildSbPreviewSize 351 kB 351 kB 0 B - 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.46 MB 4.46 MB 0 B - 0%
buildPreviewSize 3 MB 3 MB 0 B 0.71 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 7.3s 25.2s 17.8s 1.11 70.7%
generateTime 21.5s 22.2s 627ms 3.2 2.8%
initTime 20s 20.9s 852ms 1.67 4.1%
buildTime 13.7s 14.1s 429ms 1.31 3%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 7.3s 7.3s -7ms 1.24 -0.1%
devManagerResponsive 4.8s 5s 200ms 2.09 3.9%
devManagerHeaderVisible 750ms 819ms 69ms 4.45 🔺8.4%
devManagerIndexVisible 758ms 852ms 94ms 4.7 🔺11%
devStoryVisibleUncached 1.2s 1.3s 100ms 1.44 🔺7.1%
devStoryVisible 789ms 853ms 64ms 3.94 🔺7.5%
devAutodocsVisible 733ms 676ms -57ms 0.27 -8.4%
devMDXVisible 805ms 702ms -103ms -0.14 -14.7%
buildManagerHeaderVisible 716ms 718ms 2ms 1.42 0.3%
buildManagerIndexVisible 725ms 719ms -6ms 0.7 -0.8%
buildStoryVisible 796ms 752ms -44ms 0.38 -5.9%
buildAutodocsVisible 637ms 606ms -31ms -3.1 🔰-5.1%
buildMDXVisible 692ms 695ms 3ms 0.79 0.4%

Greptile Summary

This PR introduces portable stories support for SvelteKit in Storybook, enabling the use of the Vitest addon plugin.

  • Added storybookSveltekitPlugin in code/frameworks/sveltekit/src/vite.ts for SvelteKit integration
  • Updated package.json to include new 'vite' export and bundler entries
  • Modified sandbox templates to support SvelteKit in portable stories
  • Removed 'vitest-integration' from skipTasks for SvelteKit templates in sandbox-templates.ts
  • Increased parallelism for Vitest integration tests in CircleCI configuration

@yannbf yannbf added ci:daily Run the CI jobs that normally run in the daily job. sveltekit portable stories labels Aug 19, 2024
Copy link

nx-cloud bot commented Aug 19, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 16b4f11. 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 target

Sent with 💌 from NxCloud.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings

@@ -0,0 +1,5 @@
import { mockSveltekitStores } from './plugins/mock-sveltekit-stores'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding a brief comment explaining the purpose of this file and the storybookSveltekitPlugin

Comment on lines 3 to 5
export const storybookSveltekitPlugin = () => {
return [mockSveltekitStores()]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding type annotations for better clarity and to prevent potential issues

@@ -360,17 +360,40 @@ async function linkPackageStories(
);
}

const getVitestPluginInfo = (details: TemplateDetails) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding a type annotation for the return value of getVitestPluginInfo

@yannbf yannbf force-pushed the yann/add-sveltekit-portable-stories branch from 705967e to d8ee6ed Compare August 19, 2024 09:52
Copy link
Contributor

@kasperpeulen kasperpeulen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from yann/introduce-project-annotations-to-other-packages to next August 19, 2024 11:06
@yannbf yannbf merged commit 31c9141 into next Aug 19, 2024
105 checks passed
@yannbf yannbf deleted the yann/add-sveltekit-portable-stories branch August 19, 2024 11:07
@github-actions github-actions bot mentioned this pull request Aug 19, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:daily Run the CI jobs that normally run in the daily job. feature request portable stories sveltekit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce portable stories support for SvelteKit
2 participants