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

Addon Test: Adjust file exports to be ESM/CJS compatible #29471

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Oct 29, 2024

What I did

Several plain JS files at the root of the test addon were pointing at nonexistent/incorrect dist files. Also, preset.js was overriding the exports set in src/preset.ts causing the serverChannel to be missing.

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 77.6 MB 77.6 MB 76 B 0.6 0%
initSize 143 MB 143 MB 76 B -1.98 0%
diffSize 65.1 MB 65.1 MB 0 B -1.99 0%
buildSize 6.87 MB 6.87 MB 0 B -0.29 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B -0.62 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.9 MB 1.9 MB 0 B 2.38 0%
buildSbPreviewSize 271 kB 271 kB 0 B -0.42 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.88 MB 3.88 MB 0 B -0.29 0%
buildPreviewSize 3 MB 3 MB 0 B -0.65 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 20.7s 22.2s 1.5s 1.29 🔺7%
generateTime 24.4s 18.6s -5s -786ms -2.22 🔰-30.9%
initTime 16.6s 12.7s -3s -950ms -2 🔰-31.1%
buildTime 7.8s 9.1s 1.2s -0.61 13.6%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.7s 5.2s -503ms -1.63 🔰-9.6%
devManagerResponsive 3.5s 3.2s -286ms -1.89 🔰-8.8%
devManagerHeaderVisible 543ms 553ms 10ms -0.88 1.8%
devManagerIndexVisible 622ms 590ms -32ms -1.01 -5.4%
devStoryVisibleUncached 1.1s 848ms -287ms -1.08 -33.8%
devStoryVisible 620ms 585ms -35ms -0.9 -6%
devAutodocsVisible 486ms 472ms -14ms -1.19 -3%
devMDXVisible 403ms 492ms 89ms -0.94 18.1%
buildManagerHeaderVisible 526ms 550ms 24ms -0.94 4.4%
buildManagerIndexVisible 542ms 563ms 21ms -0.96 3.7%
buildStoryVisible 518ms 549ms 31ms -0.93 5.6%
buildAutodocsVisible 447ms 490ms 43ms -0.73 8.8%
buildMDXVisible 434ms 450ms 16ms -0.96 3.6%

Greptile Summary

Updates addon-test module exports to support dual ESM/CJS compatibility by adding .mjs files and restructuring existing module exports.

  • Added code/addons/test/manager.mjs, postinstall.mjs, and preset.mjs for ESM support
  • Modified code/addons/test/manager.js and preset.js to use CommonJS require syntax
  • Removed redundant code/addons/test/postinstall.cjs and preset.cjs files
  • Simplified preset exports by removing explicit previewAnnotations implementation in favor of dist directory exports

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.

LGTM

8 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

nx-cloud bot commented Oct 29, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit bddd5b0. 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 2 targets

Sent with 💌 from NxCloud.

@valentinpalkovic valentinpalkovic merged commit a3f3f90 into next Oct 29, 2024
68 of 74 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-addon-test-exports branch October 29, 2024 11:55
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