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 sandbox generation in linked mode #30469

Merged

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Feb 5, 2025

Closes #

What I did

Locally generated sandboxes in linked mode sometimes had corrupted sandboxes. This issue is now fixed by only running installs when necessary.

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 0 B 1.51 0%
initSize 132 MB 78.3 MB -53.2 MB -270.62 🔰-67.9%
diffSize 53.2 MB 97 B -53.2 MB -983.77 🔰-54839826.8%
buildSize 7.22 MB 7.22 MB 0 B 3 0%
buildSbAddonsSize 1.87 MB 1.87 MB 0 B 3 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.88 MB 1.88 MB 0 B 3 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.95 MB 3.95 MB 0 B 3 0%
buildPreviewSize 3.27 MB 3.27 MB 0 B 2.99 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 8.9s 8s -907ms -1.55 🔰-11.3%
generateTime 17.9s 21.1s 3.1s 0.81 14.9%
initTime 11.4s 5.3s -6s -175ms -4.29 🔰-116%
buildTime 8.6s 9.9s 1.2s 0.9 12.8%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.6s 4.9s 253ms -0.52 5.2%
devManagerResponsive 3.6s 3.6s 26ms -0.67 0.7%
devManagerHeaderVisible 658ms 838ms 180ms 0.52 21.5%
devManagerIndexVisible 718ms 911ms 193ms 0.77 21.2%
devStoryVisibleUncached 3.6s 4s 419ms 0.41 10.3%
devStoryVisible 720ms 912ms 192ms 0.64 21.1%
devAutodocsVisible 653ms 829ms 176ms 1.01 21.2%
devMDXVisible 643ms 756ms 113ms 0.53 14.9%
buildManagerHeaderVisible 744ms 825ms 81ms 0.33 9.8%
buildManagerIndexVisible 843ms 990ms 147ms 1.01 14.8%
buildStoryVisible 672ms 807ms 135ms 0.77 16.7%
buildAutodocsVisible 570ms 645ms 75ms -0.21 11.6%
buildMDXVisible 544ms 750ms 206ms 1.78 🔺27.5%

Greptile Summary

Here's my concise review of the pull request:

Fixes sandbox generation in linked mode by improving dependency management and installation processes across multiple files to prevent sandbox corruption.

  • Added skip-install option to init CLI step in scripts/utils/cli-step.ts to prevent duplicate installations
  • Modified scripts/tasks/sandbox-parts.ts to handle package.json updates directly instead of relying on package manager state
  • Updated code/lib/cli-storybook/src/link.ts to write package.json changes before running yarn install
  • Added final dependency installation step using JsPackageManagerFactory in scripts/tasks/sandbox.ts to ensure proper installation

The changes focus on making dependency management more controlled and predictable to prevent sandbox corruption issues in linked mode.

@valentinpalkovic valentinpalkovic self-assigned this Feb 5, 2025
@valentinpalkovic valentinpalkovic added build Internal-facing build tooling & test updates ci:normal labels Feb 5, 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.

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

code/lib/cli-storybook/src/link.ts Outdated Show resolved Hide resolved
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-local-sandbox-generation-in-link-mode branch from 8498e6c to 9b1de99 Compare February 5, 2025 11:29
@valentinpalkovic valentinpalkovic force-pushed the valentin/fix-local-sandbox-generation-in-link-mode branch from f6bc823 to 1dcaa0f Compare February 5, 2025 11:40
Copy link

nx-cloud bot commented Feb 5, 2025

View your CI Pipeline Execution ↗ for commit 3b73b65.

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

☁️ Nx Cloud last updated this comment at 2025-02-05 12:29:30 UTC

@valentinpalkovic valentinpalkovic merged commit 02baa78 into next Feb 5, 2025
55 of 58 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-local-sandbox-generation-in-link-mode branch February 5, 2025 12:43
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