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

Csf Tools: Allow ConfigFile to create more import syntaxes #30204

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Jan 7, 2025

Relates to #30203

What I did

This PR allows the ConfigFile to create two new syntaxes of import:

import 'side-effect'
import * as annotations from 'some-addon'

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-storybook/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 77.8 MB 77.8 MB 590 B 0.47 0%
initSize 131 MB 131 MB 2.28 kB -1.36 0%
diffSize 53 MB 53 MB 1.69 kB -1.36 0%
buildSize 7.19 MB 7.19 MB 0 B -0.33 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B -0.31 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 0 B 0.14 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.91 MB 3.91 MB 0 B -0.31 0%
buildPreviewSize 3.28 MB 3.28 MB 0 B -2.38 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 23.6s 6.9s -16s -698ms -0.81 -240.2%
generateTime 21.9s 18.8s -3s -92ms -0.91 -16.4%
initTime 15.5s 12.7s -2s -854ms -0.73 -22.4%
buildTime 8.7s 11.8s 3.1s 2.4 🔺26.3%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.1s 4.2s -931ms -1.81 🔰-22.1%
devManagerResponsive 3.7s 3.1s -532ms -1.78 🔰-16.8%
devManagerHeaderVisible 605ms 557ms -48ms -1.24 🔰-8.6%
devManagerIndexVisible 635ms 562ms -73ms -1.61 🔰-13%
devStoryVisibleUncached 2s 1.7s -388ms -0.67 -22.8%
devStoryVisible 636ms 589ms -47ms -1.37 🔰-8%
devAutodocsVisible 491ms 472ms -19ms -1.46 -4%
devMDXVisible 525ms 435ms -90ms -1.8 🔰-20.7%
buildManagerHeaderVisible 519ms 508ms -11ms -1.44 -2.2%
buildManagerIndexVisible 610ms 611ms 1ms -1.29 0.2%
buildStoryVisible 510ms 495ms -15ms -1.48 -3%
buildAutodocsVisible 427ms 425ms -2ms -1.3 -0.5%
buildMDXVisible 485ms 413ms -72ms -1.53 🔰-17.4%

Greptile Summary

Here's my concise summary of the pull request:

Enhanced ConfigFile class to support additional import syntaxes in Storybook configuration files, specifically adding support for namespace imports and side-effect imports.

  • Added support for side-effect imports (import 'foo') in ConfigFile.ts
  • Added support for namespace imports (import * as foo from 'bar') in ConfigFile.ts
  • Added comprehensive test coverage for new import syntaxes in ConfigFile.test.ts
  • Maintained backward compatibility with existing import handling functionality
  • Implemented proper type checking and error handling for new import cases

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.

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

code/core/src/csf-tools/ConfigFile.ts Show resolved Hide resolved
Copy link

nx-cloud bot commented Jan 7, 2025

View your CI Pipeline Execution ↗ for commit 3e3b003.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 36s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-07 11:12:22 UTC

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