Build: Fix critical bug in the pre-build hook#32468
Merged
Merged
Conversation
Contributor
|
4e4b9d8 to
7c56bea
Compare
|
View your CI Pipeline Execution ↗ for commit 7c56bea
☁️ Nx Cloud last updated this comment at |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical bug in Storybook's pre-build hook system where the source file generation script wasn't executing properly, and includes major dependency updates for several core packages.
- Added execution call to make the generate-source-files.ts script self-executing
- Refactored path construction for better maintainability using a shared CODE_DIR constant
- Updated major dependencies (commander v12→v14, boxen v7→v8, giget v1→v2) across multiple packages
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| code/core/scripts/generate-source-files.ts | Fixed script execution and improved path handling with CODE_DIR constant |
| code/core/build-config.ts | Removed unused fs import |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This was referenced Sep 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Fix critical bug in pre-build script
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake 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/coreteam 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>Greptile Summary
Updated On: 2025-09-16 09:03:53 UTC
This PR addresses a critical bug in Storybook's pre-build hook system by making key fixes and dependency updates. The core issue was that the
generate-source-files.tsscript wasn't self-executing when called by the pre-build hook inbuild-config.ts. The main changes include:Fixed the pre-build script execution: Added a direct function call
generateSourceFiles()at the end ofgenerate-source-files.tsto make it self-executing when run via jiti. Without this, the pre-build hook would load the script but not actually generate the critical source files needed for the build.Code cleanup and organization: Removed unused
fsimport frombuild-config.tsand refactored path construction in the generator script to use a sharedCODE_DIRconstant for better maintainability.Major dependency updates: Updated
commander(v12 → v14),boxen(v7 → v8), andgiget(v1 → v2) across multiple packages (@storybook/core,@storybook/cli, and@storybook/create-storybook). These updates likely resolve compatibility issues that were contributing to the pre-build failures.The pre-build hook is critical to Storybook's build process as it generates framework types, version mappings, and export configurations that other parts of the system depend on. The script uses esbuild to compile TypeScript files, generates framework metadata, and formats output with prettier. Without proper execution, this would cause silent failures leading to stale or missing generated files that could break the entire build pipeline.
Confidence score: 4/5
package.jsonfiles as they involve major version bumps that could introduce breaking changes