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

Build: Fix local sandbox generation in linked mode #30471

Merged

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Feb 5, 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 78.3 MB 78.3 MB 18 kB 1.32 0%
initSize 78.3 MB 78.3 MB 18 kB -3 0%
diffSize 97 B 97 B 0 B -3 0%
buildSize 7.22 MB 7.22 MB 0 B 2 0%
buildSbAddonsSize 1.87 MB 1.87 MB 0 B 2 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.88 MB 1.88 MB 0 B 2 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.95 MB 3.95 MB 0 B 2 0%
buildPreviewSize 3.27 MB 3.27 MB 0 B 2 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.4s 20s 12.6s 0.48 63%
generateTime 19.1s 20.9s 1.8s 0.65 8.8%
initTime 5.1s 5.4s 233ms -2.25 4.3%
buildTime 10.6s 9.6s -998ms 0.52 -10.3%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.3s 5s -1s -297ms -0.41 -25.6%
devManagerResponsive 4.7s 3.8s -942ms -0.38 -24.6%
devManagerHeaderVisible 761ms 671ms -90ms -1.04 -13.4%
devManagerIndexVisible 784ms 681ms -103ms -1.54 🔰-15.1%
devStoryVisibleUncached 4.1s 4s -105ms 0.37 -2.6%
devStoryVisible 785ms 700ms -85ms -1.28 🔰-12.1%
devAutodocsVisible 815ms 646ms -169ms -1.08 -26.2%
devMDXVisible 791ms 623ms -168ms -1.19 -27%
buildManagerHeaderVisible 769ms 807ms 38ms 0.01 4.7%
buildManagerIndexVisible 928ms 928ms 0ms 0.24 0%
buildStoryVisible 745ms 751ms 6ms -0.06 0.8%
buildAutodocsVisible 701ms 624ms -77ms -0.51 -12.3%
buildMDXVisible 581ms 750ms 169ms 1.33 🔺22.5%

Greptile Summary

This PR improves sandbox generation in linked mode by addressing dependency installation issues and cleanup processes, particularly focusing on the Nuxt generator and linking functionality.

  • Modified code/lib/create-storybook/src/generators/NUXT/index.ts to force node_modules removal before dependency installation
  • Updated scripts/tasks/sandbox.ts to properly handle sandbox directory cleanup and dependency installation in linked mode
  • Enhanced code/lib/cli-storybook/src/link.ts with improved error handling and added webpack-hot-middleware dependencies
  • Added safety checks for package.json parsing after yarn version verification

@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-local-sandbox-generation-in-link-mode-2 branch from 08d1478 to a918a9b Compare February 5, 2025 15:09
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.

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

@@ -26,6 +29,7 @@ const generator: Generator = async (packageManager, npmOptions, options) => {
console.log(
'The --skip-install flag is not supported for generating Storybook for Nuxt. We will continue to install dependencies.'
);
await execa('rm', ['-rf', 'node_modules']);
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Forcibly removing node_modules is dangerous. Consider checking if it exists first and handling potential errors.

scripts/tasks/sandbox.ts Show resolved Hide resolved
scripts/tasks/sandbox.ts Show resolved Hide resolved
scripts/tasks/sandbox.ts Show resolved Hide resolved
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-local-sandbox-generation-in-link-mode-2 branch from a918a9b to b38ac98 Compare February 5, 2025 15:10
Copy link

nx-cloud bot commented Feb 5, 2025

View your CI Pipeline Execution ↗ for commit b38ac98.

Command Status Duration Result
nx affected -t check -c production --parallel=7 ✅ Succeeded 6s View ↗
nx run-many -t build -c production --parallel=3 ✅ Succeeded 11s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-05 15:17:02 UTC

@valentinpalkovic valentinpalkovic self-assigned this Feb 5, 2025
@valentinpalkovic valentinpalkovic added ci:normal build Internal-facing build tooling & test updates labels Feb 5, 2025
@valentinpalkovic valentinpalkovic merged commit 374ee3d into next Feb 5, 2025
63 of 71 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-local-sandbox-generation-in-link-mode-2 branch February 5, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Internal-facing build tooling & test updates ci:normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants