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

Core: Make sure beforeAll is properly typed #28864

Merged
merged 6 commits into from
Aug 12, 2024
Merged

Conversation

kasperpeulen
Copy link
Contributor

@kasperpeulen kasperpeulen commented Aug 12, 2024

What I did

  • Make sure beforeAll is typed as non-nullable
  • Loosen project annotatation type, otherwise people will get errors when non-renderer specific addons are passed as proejct annotation

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.33 0%
initSize 167 MB 167 MB -74 B -0.85 0%
diffSize 91.2 MB 91.2 MB -74 B -0.85 0%
buildSize 7.43 MB 7.43 MB -112 B -0.71 0%
buildSbAddonsSize 1.61 MB 1.61 MB -74 B -0.71 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 2.3 MB 2.3 MB 0 B -0.63 0%
buildSbPreviewSize 350 kB 350 kB -38 B 0.32 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 4.46 MB 4.46 MB -112 B -0.69 0%
buildPreviewSize 2.97 MB 2.97 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 16.1s 6.5s -9s -593ms -1.36 🔰-146.3%
generateTime 19.3s 19.1s -234ms -1.08 -1.2%
initTime 16.6s 16.5s -125ms -1.25 -0.8%
buildTime 12s 12.8s 757ms -0.29 5.9%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 8.1s 7.6s -483ms -1.11 -6.3%
devManagerResponsive 4.9s 4.9s 35ms -1.06 0.7%
devManagerHeaderVisible 810ms 709ms -101ms -1.27 🔰-14.2%
devManagerIndexVisible 840ms 735ms -105ms -1.29 🔰-14.3%
devStoryVisibleUncached 1.1s 1.2s 64ms -0.62 5.2%
devStoryVisible 853ms 745ms -108ms -1.4 🔰-14.5%
devAutodocsVisible 742ms 649ms -93ms -1.22 -14.3%
devMDXVisible 701ms 636ms -65ms -1.2 -10.2%
buildManagerHeaderVisible 849ms 696ms -153ms -1.09 -22%
buildManagerIndexVisible 850ms 698ms -152ms -1.1 -21.8%
buildStoryVisible 890ms 729ms -161ms -1.18 -22.1%
buildAutodocsVisible 696ms 609ms -87ms -1.46 🔰-14.3%
buildMDXVisible 711ms 660ms -51ms -0.93 -7.7%

Greptile Summary

The changes ensure beforeAll is typed as non-nullable and loosen project annotation types to avoid errors with non-renderer specific addons.

  • code/.storybook/preview.tsx: Updated Loader type import and loaders array typing to improve type safety.
  • code/.storybook/storybook.setup.ts: Removed non-null assertion from annotations.beforeAll to ensure proper initialization.
  • code/core/src/preview-api/modules/store/csf/composeConfigs.ts: Updated type imports and return type to NormalizedProjectAnnotations.
  • code/core/src/preview-api/modules/store/csf/portable-stories.ts: Adjusted global variable and return type to NormalizedProjectAnnotations.
  • code/renderers/react/src/portable-stories.tsx: Modified setProjectAnnotations function to ensure proper typing and flexibility.

… into beforeall

# Conflicts:
#	code/.storybook/preview.tsx
#	code/frameworks/nextjs/src/portable-stories.ts
#	code/renderers/react/src/portable-stories.tsx
#	code/renderers/svelte/src/portable-stories.ts
#	code/renderers/vue3/src/portable-stories.ts
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.

8 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings

code/frameworks/nextjs/src/portable-stories.ts Outdated Show resolved Hide resolved
Copy link

nx-cloud bot commented Aug 12, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 603ea16. 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.

@yannbf yannbf self-assigned this Aug 12, 2024
@kasperpeulen kasperpeulen added ci:daily Run the CI jobs that normally run in the daily job. and removed ci:daily Run the CI jobs that normally run in the daily job. labels Aug 12, 2024
@kasperpeulen kasperpeulen merged commit 898405e into vitest-integration Aug 12, 2024
47 of 50 checks passed
@kasperpeulen kasperpeulen deleted the beforeall branch August 12, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants