Skip to content

Conversation

@harshasiddartha
Copy link

Description

This PR adds a pre-merge check to ensure that all packages in package.json files use specific versions instead of range specifiers (^, ~, >=, <=, >, <, *, x, latest, etc.).

Changes

  • ✅ Added scripts/check-package-versions.js script that:

    • Scans all package.json files in the repository
    • Checks dependencies, devDependencies, peerDependencies, and optionalDependencies
    • Detects range specifiers and reports violations
    • Provides warnings for engines field (which typically allows ranges)
  • ✅ Added check-package-versions script to package.json scripts section

  • ✅ Added GitHub Actions workflow job checkPackageVersions to .github/workflows/pull_request.yml:

    • Runs on PR open, reopen, and synchronize events
    • Fails the CI if any package.json files contain range specifiers
    • Uses Node.js 24 (matching the project's engine requirement)

Testing

  • ✅ Script successfully validates existing package.json files
  • ✅ Current package.json already uses specific versions (chalk: 4.1.2)
  • ✅ Script correctly identifies range specifiers when tested

Related Issue

Fixes #50604

Checklist

  • Code follows the project's style guidelines
  • Tests have been added/updated
  • Documentation has been updated (if needed)
  • All existing tests pass
  • No new warnings introduced

- Add check-package-versions.js script to validate package.json files
- Script checks dependencies, devDependencies, peerDependencies, and optionalDependencies
- Detects range specifiers (^, ~, >=, <=, >, <, *, x, latest, etc.)
- Add check-package-versions script to package.json
- Add GitHub Actions workflow job to run check on PRs
- Fixes brave#50604
@harshasiddartha harshasiddartha requested a review from a team as a code owner November 1, 2025 11:16
@diracdeltas
Copy link
Member

@mihaiplesa PTAL as i think you may have started working on this

@701-cg

This comment was marked as spam.

@mihaiplesa
Copy link
Contributor

@harshasiddartha thank you for the contribution but we've chosen a different approach so closing this.

@mihaiplesa mihaiplesa closed this Nov 5, 2025
@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

3 similar comments
@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

2 similar comments
@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

3 similar comments
@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

1 similar comment
@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

2 similar comments
@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

1 similar comment
@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

@701-cg

This comment was marked as spam.

1 similar comment
@701-cg

This comment was marked as spam.

@brave brave locked as spam and limited conversation to collaborators Nov 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add pre-merge check for non-locked packages

4 participants