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: Gracefully handle empty folders on dev machines #29287

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

tobiasdiez
Copy link
Contributor

@tobiasdiez tobiasdiez commented Oct 7, 2024

Closes #

What I did

I had some troubles building the latest storybook on my machine; after some investigation it tourned out that I still had an empty folder lying around from a package that recentently was deleted/merged with another package. I've improved handling of this case a bit better, printing a helpful error message and just moving on without failing the build.

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 78.7 MB 78.7 MB 0 B 1.23 0%
initSize 150 MB 151 MB 792 kB -0.17 0.5%
diffSize 71.8 MB 72.6 MB 792 kB -0.7 1.1%
buildSize 6.77 MB 6.77 MB 0 B -0.49 0%
buildSbAddonsSize 1.5 MB 1.5 MB 0 B -0.5 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.83 MB 1.83 MB 0 B -0.48 0%
buildSbPreviewSize 270 kB 270 kB 0 B -0.5 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.8 MB 3.8 MB 0 B -0.49 0%
buildPreviewSize 2.97 MB 2.97 MB 0 B -0.77 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.4s 6.9s -13s -522ms -1.28 🔰-195.2%
generateTime 19.8s 24.2s 4.3s 1.16 18.1%
initTime 13.5s 16.3s 2.8s 0.64 17.1%
buildTime 9.9s 8.6s -1s -268ms -1.05 -14.7%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 6.1s 6.1s -54ms -0.9 -0.9%
devManagerResponsive 3.9s 3.7s -209ms -1.19 -5.5%
devManagerHeaderVisible 582ms 528ms -54ms -0.78 -10.2%
devManagerIndexVisible 617ms 561ms -56ms -0.74 -10%
devStoryVisibleUncached 1s 870ms -174ms -0.93 -20%
devStoryVisible 619ms 562ms -57ms -0.74 -10.1%
devAutodocsVisible 443ms 456ms 13ms -0.69 2.9%
devMDXVisible 496ms 462ms -34ms -0.67 -7.4%
buildManagerHeaderVisible 463ms 437ms -26ms -0.84 -5.9%
buildManagerIndexVisible 466ms 567ms 101ms -0.21 17.8%
buildStoryVisible 542ms 568ms 26ms -0.38 4.6%
buildAutodocsVisible 412ms 517ms 105ms -0.22 20.3%
buildMDXVisible 437ms 385ms -52ms -1.08 -13.5%

Greptile Summary

This PR improves error handling for empty folders during the Storybook build process, enhancing the robustness of the build system.

  • Modified scripts/prepare/tools.ts to check for package.json existence in workspace directories
  • Added warning message for empty folders instead of failing the build
  • Skips empty directories gracefully to prevent build failures from leftover folders
  • Enhances developer experience by providing helpful error messages for missing package.json files
  • Improves overall build stability by handling edge cases related to workspace directory structure

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

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

Copy link

nx-cloud bot commented Oct 7, 2024

☁️ Nx Cloud Report

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

@shilman shilman added build Internal-facing build tooling & test updates ci:normal labels Oct 7, 2024
@shilman shilman changed the title Chore: gracefully handle empty folders on dev machines Build: Gracefully handle empty folders on dev machines Oct 7, 2024
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.

3 participants