Skip to content

Update package.json to modify react-is dependency #6371

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

Merged
merged 5 commits into from
Jul 23, 2025
Merged

Conversation

mattcosta7
Copy link
Contributor

@mattcosta7 mattcosta7 commented Jul 23, 2025

This pull request updates the dependencies in the packages/react/package.json file, primarily focusing on upgrading react-related packages and ensuring compatibility with new versions. The most significant changes include the addition and upgrade of react-is and its associated type definitions, as well as adjustments to peer dependencies.

Primer fails to install in a react 19 project because the dependency on react-is conflicts, by making it a peer we avoid that conflcit

Changelog

New

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Remove react-is from dependencies and add to peerDependencies
Copy link

changeset-bot bot commented Jul 23, 2025

🦋 Changeset detected

Latest commit: 93527df

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 23, 2025
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@@ -218,9 +216,11 @@
"peerDependencies": {
"@types/react": "18.x || 19.x",
"@types/react-dom": "18.x || 19.x",
"@types/react-is": "18.x || 19.x",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional peer

@github-actions github-actions bot temporarily deployed to storybook-preview-6371 July 23, 2025 16:43 Inactive
@github-actions github-actions bot requested a deployment to storybook-preview-6371 July 23, 2025 16:48 Abandoned
Copy link
Contributor

github-actions bot commented Jul 23, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 92.26 KB (0%)
packages/react/dist/browser.umd.js 92.35 KB (0%)

@mattcosta7 mattcosta7 marked this pull request as ready for review July 23, 2025 17:11
@Copilot Copilot AI review requested due to automatic review settings July 23, 2025 17:11
@mattcosta7 mattcosta7 requested a review from a team as a code owner July 23, 2025 17:11
@mattcosta7 mattcosta7 requested a review from francinelucca July 23, 2025 17:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR resolves a React 19 compatibility issue by converting react-is from a direct dependency to a peer dependency, preventing installation conflicts when Primer is used in React 19 projects. The change also updates related TypeScript type definitions and ensures proper version compatibility.

Key changes:

  • Moved react-is and @types/react-is from dependencies to peer dependencies with version ranges supporting both React 18.x and 19.x
  • Updated TypeScript type definitions for React-related packages to newer patch versions
  • Added optional peer dependency metadata for @types/react-is

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
packages/react/package.json Restructured dependencies to move react-is to peer dependencies and updated type definitions
.changeset/tall-pets-obey.md Added changeset entry documenting the peer dependency corrections

@mattcosta7 mattcosta7 enabled auto-merge July 23, 2025 17:11
@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/392407

@mattcosta7 mattcosta7 added this pull request to the merge queue Jul 23, 2025
@joshblack joshblack removed this pull request from the merge queue due to a manual request Jul 23, 2025
@joshblack
Copy link
Member

joshblack commented Jul 23, 2025

For context on removing from the queue, just was waiting for the integration PR to pass 👀

The only thing I'm worried about is adding a new peerDependency here in a minor release since they are not auto-installed so we will need to update install instructions to include this now.

Could we instead update the range on the dependency? e.g. "react-is": "18.x || 19.x" or would that not work as expected?

@primer-integration
Copy link

🟢 golden-jobs completed with status success.

@github-actions github-actions bot added integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jul 23, 2025
@mattcosta7
Copy link
Contributor Author

For context on removing from the queue, just was waiting for the integration PR to pass 👀

The only thing I'm worried about is adding a new peerDependency here in a minor release since they are not auto-installed so we will need to update install instructions to include this now.

Could we instead update the range on the dependency? e.g. "react-is": "18.x || 19.x" or would that not work as expected?

NPM started installing peerDependencies by default in version 7 https://github.blog/news-insights/product-news/npm-7-is-now-generally-available/#peer-dependencies

Automatically installing peer dependencies is an exciting new feature introduced in npm 7

I don't think we should be installing a version of it for consumers and 2 versions installed could cause some conflcits I think? (although they're generally backwards compat). With that said, a broader dependency might be ok - but is probably not ideal?

@joshblack
Copy link
Member

joshblack commented Jul 23, 2025

Oh nice! Didn't realize that was added (thanks for sharing)

I don't think we should be installing a version of it for consumers and 2 versions installed could cause some conflcits I think?

What scenarios would you expect to have two versions installed? Was trying to think through it:

Type Primer Consumer Installed
dependencies v18 v19 v18, v19
peerDependencies v18 v19 Would this be an error with the new behavior in npm v7?
dependencies v18 || v19 v19 v19
peerDependencies v18 || v19 v19 v19

Are there any that I'm missing? 👀

@mattcosta7
Copy link
Contributor Author

Oh nice! Didn't realize that was added (thanks for sharing)

I don't think we should be installing a version of it for consumers and 2 versions installed could cause some conflcits I think?

What scenarios would you expect to have two versions installed? Was trying to think through it:

Type Primer Consumer Installed
dependencies v18 v19 v18, v19
peerDependencies v18 v19 Would this be an error with the new behavior in npm v7?
dependencies v18 || v19 v19 v19
peerDependencies v18 || v19 v19 v19
Are there any that I'm missing? 👀

I think they generally should resolve to a single version, but I could see npm nesting one inside the pacakge instead when upgrading - I don't think it's a common case where that would happen instead of hosting, but maybe not impossible?

@joshblack
Copy link
Member

Sounds good 👍 Definitely down to try this out. Thanks for making the PR!

@joshblack joshblack enabled auto-merge July 23, 2025 21:39
@joshblack joshblack disabled auto-merge July 23, 2025 21:39
@joshblack joshblack merged commit 73ce4b4 into main Jul 23, 2025
46 checks passed
@joshblack joshblack deleted the mattcosta7-patch-1 branch July 23, 2025 21:39
@primer primer bot mentioned this pull request Jul 23, 2025
@mattcosta7
Copy link
Contributor Author

Sounds good 👍 Definitely down to try this out. Thanks for making the PR!

no problem! thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants