react-terminal icon indicating copy to clipboard operation
react-terminal copied to clipboard

Update to React 18

Open raaaahman opened this issue 2 years ago β€’ 4 comments

Changes

To insure compatibility with React 18 (both in development and production), this PR:

  • Removes Enzyme libraries and use directly react-test-renderer (updated)
  • Jest has been updated to version 28, which provoked ts-jest and then typescript to be updated as well

Suggestions

Remove the npm-install-peers package and include reactand react-domas developement dependencies, as suggested by the package's maintainers: it would make installing peer dependencies easier for contributors, since they will all be managed by yarn/npm in one step.

raaaahman avatar Jun 10 '22 15:06 raaaahman

@raaaahman πŸ‘‹ Thanks for the PR. I have changed the main branch to develop to test out the changes but looks like there are some conflicts. Can you please resolve them?

bony2023 avatar Jun 12 '22 14:06 bony2023

After working on updating the packages, I didn't find a configuration that works for both React 17 AND React 18: The issue is the react-test-rendererpackage that can only work with one or another.

Fortunately, this is just about development dependencies, but installing the package with the --legacy-peer-deps flag is totally viable in a React 18 app at the moment.

So it all depends on whether you'd like continue the development in a React 17 or 18 environment.

Maybe then, adding your preferred development version in the devDependencies and specifying react@^17.0.2 || ^18.1.0 would be all it takes to allow installing it without the --legacy-peer-deps flag?

raaaahman avatar Jun 13 '22 14:06 raaaahman

Ah I see. I believe we can get this PR ready to only work with React 18. Let’s make this compatible with latest React version.

bony2023 avatar Jun 17 '22 09:06 bony2023

Here, I rebased my work on your latest developcommit. Not sure if this is worth it though, since the example run in React 18 pretty well.

Maybe all you need is to update the readme to say that it needs the --legacy-peer-deps flag to be installed through npm?

Another solution would be to move the React 17.0.2 dependency in the dev dependencies, and put react@>=17.0.2 in the peer dependencies? So you would be running React 17 in development, and React 17 || 18 in production, without NPM warnings...

Tell me if this last solution interests you, I might try to implement it (this would replace this PR though).

raaaahman avatar Jun 18 '22 11:06 raaaahman

Closing this as the package was recently updated to support react 18

bony2023 avatar Sep 24 '22 21:09 bony2023