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

Scripts: Only output esm for nodeEntries on request #30213

Merged
merged 6 commits into from
Jan 10, 2025

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Jan 8, 2025

Closes #

What I did

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 0 B -2.12 0%
initSize 131 MB 131 MB 0 B -0.34 0%
diffSize 53 MB 53 MB 0 B -0.33 0%
buildSize 7.19 MB 7.19 MB 0 B 1.08 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 0 B -0.82 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.82 0%
buildPreviewSize 3.28 MB 3.28 MB 0 B 1.09 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 11.8s 6.7s -5s -126ms -1.37 🔰-76.1%
generateTime 22.5s 19.1s -3s -413ms -1.15 -17.9%
initTime 15.1s 12.8s -2s -248ms -1.1 -17.5%
buildTime 8.2s 9.7s 1.4s 0.21 15.3%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.2s 4.8s -383ms -0.48 -7.8%
devManagerResponsive 3.9s 3.6s -343ms -0.43 -9.5%
devManagerHeaderVisible 586ms 597ms 11ms -0.48 1.8%
devManagerIndexVisible 613ms 662ms 49ms -0.07 7.4%
devStoryVisibleUncached 2.1s 2s -153ms -0.13 -7.5%
devStoryVisible 614ms 661ms 47ms -0.15 7.1%
devAutodocsVisible 549ms 499ms -50ms -0.75 -10%
devMDXVisible 490ms 523ms 33ms -0.44 6.3%
buildManagerHeaderVisible 530ms 540ms 10ms -0.81 1.9%
buildManagerIndexVisible 621ms 628ms 7ms -0.82 1.1%
buildStoryVisible 519ms 531ms 12ms -0.77 2.3%
buildAutodocsVisible 415ms 405ms -10ms -1.53 -2.5%
buildMDXVisible 407ms 427ms 20ms -0.93 4.7%

Greptile Summary

Based on the provided files and context, I'll create a concise summary of the pull request changes:

Optimized the bundling configuration for node entries in Storybook addons to allow selective ESM/CJS output formats, with specific implementation in the test addon.

  • Modified code/addons/test/package.json to specify explicit ESM/CJS output for vitest-plugin files
  • Updated scripts/prepare/addon-bundle.ts to support format-specific node entry bundling
  • Added new NodeEntry type to handle format preferences per entry
  • Maintained backward compatibility by treating string entries as CJS-only
  • Separated build process into ESM and CJS builds based on entry preferences

@valentinpalkovic valentinpalkovic added build Internal-facing build tooling & test updates ci:normal addon: test labels Jan 8, 2025
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, 2 comment(s)
Edit PR Review Bot Settings | Greptile

scripts/prepare/addon-bundle.ts Outdated Show resolved Hide resolved
scripts/prepare/addon-bundle.ts Outdated Show resolved Hide resolved
@valentinpalkovic valentinpalkovic force-pushed the valentin/optimize-node-entries-output branch 3 times, most recently from ed6faf4 to 50587ef Compare January 8, 2025 10:20
@storybook-pr-benchmarking
Copy link

storybook-pr-benchmarking bot commented Jan 8, 2025

Package Benchmarks

Commit: 0d4f800, ran on 10 January 2025 at 09:58:00 UTC

The following packages have significant changes to their size or dependencies:

@storybook/experimental-addon-test

Before After Difference
Dependency count 60 60 0
Self size 982 KB 761 KB 🎉 -221 KB 🎉
Dependency size 14.15 MB 14.15 MB 0 B
Bundle Size Analyzer Link Link

Copy link

nx-cloud bot commented Jan 8, 2025

View your CI Pipeline Execution ↗ for commit 0d4f800.

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

☁️ Nx Cloud last updated this comment at 2025-01-10 09:52:44 UTC

@valentinpalkovic valentinpalkovic force-pushed the valentin/optimize-node-entries-output branch from 50587ef to 6b58265 Compare January 8, 2025 10:32
@valentinpalkovic valentinpalkovic self-assigned this Jan 10, 2025
Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

LGTM

code/addons/test/package.json Show resolved Hide resolved
@valentinpalkovic valentinpalkovic merged commit 1389976 into next Jan 10, 2025
59 of 60 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/optimize-node-entries-output branch January 10, 2025 13:25
@github-actions github-actions bot mentioned this pull request Jan 10, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: test build Internal-facing build tooling & test updates ci:normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants