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

external mismatch rule checks peer deps #6

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

Conversation

cheesehary
Copy link

@cheesehary cheesehary commented Apr 12, 2022

External mismatch rule will check peer deps for version enforcement.

  1. When the peer dep only has one version, e.g "foo": "^1.0.0", it'll fix to the most common version just like other dev/prod deps
  2. When the peer dep has multiple versions, e.g "foo": "^1.0.0 || ^2.0.0", the fix varies based on allowedDependencyVersions:
    a) if multiple versions are configured in allowedDependencyVersions, like ["^2.0.0", "^3.0.0"], then it'll fix to "foo": "^2.0.0 || ^3.0.0"
    b) if no versions are configured in allowedDependencyVersions, then it'll fix to the most common version; and if there's no most common version, it'll fix to the first version. e.g "foo": "^1.0.0 || ^2.0.0" => "foo": "^1.0.0"

Testing plan:
link the package to atlassian-frontend and run yarn manypkg fix in different cases.

  1. in @atlaskit/docs, bump peer dep "react" to "^18.0.0". It should get clamped to "^16.8.0"
  2. in @atlaskit/docs, bump peer dep "react" to "^16.8.0 || ^18.0.0". It should get clamped to "^16.8.0"
  3. in root package.json, set allowedDependencyVersions to add "react": ["^16.8.0", "^18.0.0"]; in @atlaskit/docs, bump peer dep react to "^17.0.0 || ^18.0.0". It should get clamped to "^16.8.0 || ^18.0.0"
  4. in root package.json, set allowedDependencyVersions to add "react": ["^16.8.0", "^18.0.0"]; in @atlaskit/docs, bump peer dep react to "^18.0.0". It should pass the check
  5. in @atlaskit/docs, add peer dep "simple-git": "^1.0.0". It should get clamped to "^3.5.0"
  6. in @atlaskit/docs, add a new peer dep "smallest": "^1.0.0". It should pass the check
  7. in @atlaskit/docs, add a new peer dep "smallest": "^1.0.0 || ^2.0.0". It should get clamped to "^1.0.0"

@cheesehary cheesehary requested a review from ReDrUm April 12, 2022 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant