Skip to content

Conversation

@Aryaman1792
Copy link

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:

  1. Build All Packages
    Run:

    node ./scripts/build/build.js

    Expectation: All packages should build successfully with a “DONE” status per package.

  2. Build a Specific Package
    Run:

    node ./scripts/build/build.js <packageName>

    Expectation: Only the specified package should build, with appropriate build status output.

  3. Artifact Validation
    Run:

    node ./scripts/build/build.js --validate

    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.

  4. Type Definition Validation

    • For a package with "emitTypeScriptDefs": true, intentionally introduce an error in a .ts type definition.
    • Run the build script as above.
      Expectation: The build fails with an informative error about the invalid type definitions.
  5. Exports Field Rewrite Verification

    • Build a package.
    • Inspect its package.json to ensure that the "exports" field paths have been rewritten from src to dist.
      Expectation: The field should correctly point at built files in the output.
  6. Error Handling

    • Deliberately remove a required .flow.js entry point file for a package.
    • Run the build script.
      Expectation: The build should fail and report which entry point is missing.
  7. General Build Verification

    • Restore any removed files and clean up any introduced type errors.
    • Re-run the build script to confirm that it completes with no errors or warnings.

Screenshots or logs are available upon request!
This test plan covers typical, edge, and failure cases, ensuring reliability and reviewer ease for this improvement.

Improved and refactored JavaScript and type definition build processes for monorepo packages. Added stricter artifact validation, robust entry point handling, and enhanced error output.
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 11, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 11, 2025
@cipolleschi
Copy link
Contributor

@Aryaman1792 thanks for the PR, but this only adds documentation and does nothing in the codebase. It also documents an internal process, users are not supposed to run. Therefore we would refrain from importing this change as it just adds noise to the commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants