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

Move react-json-view to peer dependency #171

Merged
merged 1 commit into from
Nov 9, 2023
Merged

Move react-json-view to peer dependency #171

merged 1 commit into from
Nov 9, 2023

Conversation

carbonrobot
Copy link
Contributor

@carbonrobot carbonrobot commented Nov 9, 2023

Move @microlink/react-json-view to peer dependency. Reported by @yankovalera

Bug

Installing with npm>7.x causes an infinite loop due to conflicting React peer deps in client projects
ref: npm/cli#6611

Background

npm > 7 now installs peer dependencies by default

When running npm i @envyjs/webui in an demo repo, npm will automatically install peer dependencies and fail with an infinite loop. This is because @microlink/react-json-view has a dependency on flux, and flux has a peer dependency on React@17, while envy has a peer dependency on React@18. The current npm bug then prevents the install and crashes.

image

Locally, within the envy repo everything works as expected because we have a peer dependency resolution in our main package.json file.

Change

This moves @microlink/react-json-view to a peer dependency which has the following effect

  • When installed via npm>7 and used in the default way, @envyjs/webui will work as expected
  • When installed via npm>7 and used as a custom viewer component, @envyjs/webui will work as expected
  • When installed via yarn/pnpm and used in the default way, @envyjs/webui will work as expected
  • When installed via yarn/pnpm and used as a custom viewer component, users will also need to install @microlink/react-json-view as a dependency, since yarn/pnpm do not install peer deps automatically

Future

Many dependencies under @microlink/react-json-view are either deprecated or outdated. We should look into alternatives for json display. One possible replacement is the component we use in the groqd's arcade... monaco-editor

Avoid infinite loop in npm installs due to conflicting React peer deps in client projects ref: npm/cli#6611
Copy link

changeset-bot bot commented Nov 9, 2023

🦋 Changeset detected

Latest commit: 60ee801

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

This PR includes changesets to release 6 packages
Name Type
@envyjs/webui Patch
@envyjs/apollo Patch
@envyjs/core Patch
@envyjs/nextjs Patch
@envyjs/node Patch
@envyjs/web 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

@carbonrobot carbonrobot changed the title Move react-json-view to peer dependency Avoid infinite loop in npm installs due to conflicting React peer deps in client projects ref: https://github.com/npm/cli/issues/6611 Move react-json-view to peer dependency Nov 9, 2023
@carbonrobot carbonrobot self-assigned this Nov 9, 2023
@carbonrobot carbonrobot added the bug Something isn't working label Nov 9, 2023
@carbonrobot carbonrobot merged commit 4b1788b into main Nov 9, 2023
1 check passed
@carbonrobot carbonrobot deleted the deps/npm-bug branch November 9, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants