Refactor build process with improved validation and error handling #54491
+12
−1
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.
Improved and refactored JavaScript and type definition build processes for monorepo packages. Added stricter artifact validation, robust entry point handling, and enhanced error output.
Summary:
This PR improves the build process for JavaScript and type definitions in the monorepo by introducing more robust validation for build artifacts, refactoring entry point handling, and improving error logging for easier debugging. These changes help ensure a cleaner and more reliable build process, prevent accidental commits of build artifacts, and assist contributors in quickly identifying and resolving build issues.
Changelog:
[INTERNAL] [CHANGED] - Improved and refactored JavaScript and type definition build processes for monorepo packages. Added stricter artifact validation, robust entry point handling, and enhanced error output in
scripts/build/build.js.Test Plan:
Build All Packages
Run:
Expectation: All packages should build successfully with a “DONE” status per package.
Build a Specific Package
Run:
Expectation: Only the specified package should build, with appropriate build status output.
Artifact Validation
Run:
Expectation: If any build artifacts have been committed by accident, the script should report them and exit with a non-zero code; otherwise, it should exit with code 0 and no errors.
Type Definition Validation
"emitTypeScriptDefs": true, intentionally introduce an error in a.tstype definition.Expectation: The build fails with an informative error about the invalid type definitions.
Exports Field Rewrite Verification
package.jsonto ensure that the "exports" field paths have been rewritten fromsrctodist.Expectation: The field should correctly point at built files in the output.
Error Handling
.flow.jsentry point file for a package.Expectation: The build should fail and report which entry point is missing.
General Build Verification
Screenshots or logs are available upon request!
This test plan covers typical, edge, and failure cases, ensuring reliability and reviewer ease for this improvement.