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: Prompt switch to experimental-nextjs-vite #29814

Merged
merged 16 commits into from
Dec 10, 2024

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Dec 4, 2024

Closes #29796

What I did

When the postinstall runs of experimental-addon-test and the user is using framework nextjs prompt them to change to experimental-nexjs-vite framework.

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 postinstall is ran with yes=true in our CI.
It's used to "migrate" the experimental-nextjs-vite-default-ts sandbox already.

I've manually run the same on my machine locally, and verified the steps are executed, and the sandbox's main.ts file and package.json files are modified correctly.

QA should include generating a nextjs sandbox WITHOUT the test addon, then adding the test addon to it.
It should ask you to migrate to the experimental framework nextjs vite.

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.7 MB 77.7 MB 0 B -0.23 0%
initSize 133 MB 133 MB -7.15 kB 2.36 0%
diffSize 55.1 MB 55.1 MB -7.15 kB 2.35 0%
buildSize 6.87 MB 6.87 MB -3.78 kB 1.05 -0.1%
buildSbAddonsSize 1.51 MB 1.51 MB -219 B 2.29 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB -2.31 kB 0.46 -0.1%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.57 MB 3.57 MB -2.52 kB 1.61 -0.1%
buildPreviewSize 3.3 MB 3.3 MB -1.25 kB 1.02 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.9s 6.8s -1s -19ms -0.54 -14.8%
generateTime 25s 19.8s -5s -174ms -0.44 -26%
initTime 19s 13.8s -5s -258ms -0.04 -38.1%
buildTime 9s 8.9s -74ms 0.23 -0.8%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.2s 4.5s -719ms -0.96 -15.7%
devManagerResponsive 4s 3.4s -652ms -0.98 -19.2%
devManagerHeaderVisible 627ms 599ms -28ms 0.32 -4.7%
devManagerIndexVisible 667ms 612ms -55ms -0.47 -9%
devStoryVisibleUncached 1.9s 1.7s -217ms 0.04 -12.2%
devStoryVisible 666ms 635ms -31ms -0.05 -4.9%
devAutodocsVisible 505ms 500ms -5ms -0.44 -1%
devMDXVisible 571ms 590ms 19ms 1 3.2%
buildManagerHeaderVisible 635ms 608ms -27ms 0.16 -4.4%
buildManagerIndexVisible 746ms 704ms -42ms 0.28 -6%
buildStoryVisible 580ms 566ms -14ms 0.37 -2.5%
buildAutodocsVisible 462ms 419ms -43ms -0.58 -10.3%
buildMDXVisible 445ms 437ms -8ms -0.16 -1.8%

Greptile Summary

This PR adds functionality to prompt users to migrate from @storybook/nextjs to @storybook/experimental-nextjs-vite during the experimental-addon-test installation process, ensuring proper test addon functionality.

  • Added prompt in postinstall.ts to switch frameworks when Next.js is detected
  • Handles migration by installing @storybook/experimental-nextjs-vite and removing @storybook/next
  • Updates main config file's framework field to use experimental framework
  • Configures Vitest setup with appropriate framework plugin imports and settings
  • Maintains backward compatibility by preserving existing test configurations

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.

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

code/addons/test/src/postinstall.ts Outdated Show resolved Hide resolved
Copy link

nx-cloud bot commented Dec 5, 2024

☁️ Nx Cloud Report

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

@storybook-pr-benchmarking
Copy link

storybook-pr-benchmarking bot commented Dec 9, 2024

Package Benchmarks

Commit: b60cec0, ran on 10 December 2024 at 12:02:06 UTC

No significant changes detected, all good. 👏

code/addons/test/src/postinstall.ts Outdated Show resolved Hide resolved
code/addons/test/src/postinstall.ts Outdated Show resolved Hide resolved
@ndelangen ndelangen merged commit 190107d into next Dec 10, 2024
58 checks passed
@ndelangen ndelangen deleted the norbert/test-addon-asking-for-experimental-framework branch December 10, 2024 15:24
@github-actions github-actions bot mentioned this pull request Dec 10, 2024
11 tasks
@shilman shilman changed the title AddonTest: Prompt switch to experimental-nextjs-vite Addon Test: Prompt switch to experimental-nextjs-vite Dec 10, 2024
@ndelangen ndelangen added the needs qa Indicates that this needs manual QA during the upcoming minor/major release label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: test bug ci:normal needs qa Indicates that this needs manual QA during the upcoming minor/major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Test addon init should update framework in Next projects
3 participants