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

[docs] Force common hoist-non-react-statics version #13818

Merged

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Dec 5, 2018

TL;DR:

  • use node lts docker image in CI
    [email protected] removed the integrity checksums. The new image uses the latest yarn version
  • use resolutions field to force consistent hnrs version
  • bump hnrs version in our packages

Force a single version of hoist-non-react-statics by using the resolutions field and yarn. This should get rid of all issues concerning hoisting statics and forwardRef.

I also bumped the version of hnrs in our package.json so that the fixes are propagated faster. I think if somebody upgrades our version he doesn't necessarily upgrade transitive dependencies.

One caveat with resolutions is that it seems to be ignored if I add a package to a workspace. Running yarn will fix that.

Closes #13776

@eps1lon eps1lon added docs Improvements or additions to the documentation core package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. labels Dec 5, 2018
@eps1lon eps1lon force-pushed the docs/one-resolution-to-rule-them-all branch from 4162d71 to 676b373 Compare December 5, 2018 15:01
@eps1lon
Copy link
Member Author

eps1lon commented Dec 5, 2018

Tested it locally with [email protected] and it didn't regenerate the lockfile. Needs investigation.

@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: /tmp/material-ui
docker:
- image: circleci/node:9.10
- image: circleci/node:10.14
Copy link
Member Author

Choose a reason for hiding this comment

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

node 9 has reached its end of life anyway. So this change should be made regardless. Node 10 is in Active LTS state. See https://github.com/nodejs/Release#release-schedule

Copy link
Member

Choose a reason for hiding this comment

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

This is good to me. Can we update all the occurrences?

I have added the Node.js LTS support version breaking change in the list for v4.0.0
https://material-ui.com/getting-started/supported-platforms/#server

Copy link
Member Author

Choose a reason for hiding this comment

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

Right there were multiple ones.

But this has nothing to do with our dependencies. It might only be interesting for local development but we're not documenting a required node version or hinting at one via nvm,

@@ -16,7 +16,7 @@ const CustomTableCell = withStyles(theme => ({
body: {
fontSize: 14,
},
}))(props => <TableCell {...props} />);
}))(TableCell);
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

It looks good to me :)

@@ -172,6 +172,9 @@
"webpack-cli": "^3.1.0",
"workbox-build": "^3.6.3"
},
"resolutions": {
"**/hoist-non-react-statics": "^3.2.1"
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to force it? I believe that the issue affects withStyles, it's on our side.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just safer this way. The major bump was never needed in the first place so all this essentially does is backporting all 3.x changes to 2.x.

Copy link
Member

Choose a reason for hiding this comment

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

I find the major bump very interesting. It's ensuring people won't have a broken version.
For the resolutions part, I have one concern with the fact it might hide some problem when having multiple version installed.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what I wanted to address. It forces other packages to also pull in 3.x. There was no actual breaking change between 2.x and 3.x. It "just" patches the unmaintained packages. Another analogy is that the version of hnrs version 2.x || 3.x is equivalent to the semantic version ^2.0.0. It would have the same effect on the node_modules layout. The yarn docs describe the use case in more detail.

The issue of multiple versions is not specific to hnrs. If a package uses a broken dependency then it should be fixed. Either by patching upstream or using a patched fork (or other non-conventional methods like patch-package).

I also want to emphasize that this (intentionally) does not affect users. How they configure their build is their concern. This is only for our workspace.

Copy link
Member

@oliviertassinari oliviertassinari Dec 5, 2018

Choose a reason for hiding this comment

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

I'm all in if it can make our life easier in this challenging React update API phase.

@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: /tmp/material-ui
docker:
- image: circleci/node:9.10
- image: circleci/node:10.14
Copy link
Member

Choose a reason for hiding this comment

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

This is good to me. Can we update all the occurrences?

I have added the Node.js LTS support version breaking change in the list for v4.0.0
https://material-ui.com/getting-started/supported-platforms/#server

@@ -16,7 +16,7 @@ const CustomTableCell = withStyles(theme => ({
body: {
fontSize: 14,
},
}))(props => <TableCell {...props} />);
}))(TableCell);
Copy link
Member

Choose a reason for hiding this comment

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

It looks good to me :)

@oliviertassinari oliviertassinari merged commit 6f4869a into mui:master Dec 5, 2018
@eps1lon eps1lon deleted the docs/one-resolution-to-rule-them-all branch December 5, 2018 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants