-
-
Notifications
You must be signed in to change notification settings - Fork 27
Update NPM packages #150
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
Update NPM packages #150
Conversation
Thanks Angelo! Will take a look at merging this in after #4 is merged. |
I tested this, for starters:
Well done! What about updating the version of react? It's still set at:
CRA's latest build includes:
After testing a re-install I had a couple of warnings. The usual stuff, but here's the things in our control:
We can move from @hapi/joi to joi: https://www.npmjs.com/package/joi
We can install eslint-config-standard@>=14.1.0
We can install typescript@>= 3.x |
@@ -24,47 +23,44 @@ | |||
"@material-ui/icons": "4.9.1", | |||
"@material-ui/lab": "^4.0.0-alpha.56", | |||
"axios": "0.19.0", | |||
"json-server": "0.15.1", | |||
"npm-run-all": "4.1.5", | |||
"prop-types": "^15.7.2", | |||
"react": "16.11.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about updating the version of react?
It's still set at:
"react": "16.11.0",
"react-dom": "16.11.0",
"react-scripts": "^3.4.0",
CRA's latest build includes:
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tgrrr - my goal with this PR is to get us up to the safest, stable version of our packages. There were a few cases where we were a good couple of major versions behind. I didn't opt in to upgrade us to the latest versions of packages because in my experience, sometimes latest versions of packages can get us in dependency hell. For example, some months ago, Testing Library was updated but it also required Jest to be at a certain version. As we were using Jest from CRA, we were pinned at their version. In the end, I ended up having to set up Jest manually for this project in order for our testing infrastructure to work cohesively. This is an extreme case, but I'd like to not have to deal with those kinds of problems too often.
As the versions you mentioned are only ~2 minor / patch versions behind, I think we are safe with where we are here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also had a jest conflict with the current config @angelocordon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16.3 is a significant update to react from 16.11 https://github.com/facebook/react/releases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tgrrr re: Jest conflicts - can you expand more on what that conflict is on your end? I'm not seeing any issues on my end other than an async syntax error which I just fixed. Other than that, running npm run test
passes all suites 👍🏽. But if you're having something bigger than that, it may be worth filing an issue so we can resolve it outside of this.
re: React updates - the changes from 16.11 to 16.13 don't apply to us, we're not using lazy or memo, nor do we have a multi-root app. We're not dealing with concurrent mode, nor do I see any of the issues from their updates with ReactDOM applying to us. I think we'll eventually get to 16.13 in due time, but as of now, this feels out of the scope of this PR.
"@babel/preset-env": "^7.8.4", | ||
"@babel/core": "^7.11.6", | ||
"@babel/plugin-transform-runtime": "^7.11.5", | ||
"@babel/preset-env": "^7.11.5", | ||
"@babel/preset-react": "^7.8.3", | ||
"@sheerun/mutationobserver-shim": "^0.3.3", | ||
"@storybook/addon-actions": "^5.3.9", | ||
"@storybook/addon-links": "^5.3.9", | ||
"@storybook/addons": "^5.3.9", | ||
"@storybook/preset-create-react-app": "^1.5.2", | ||
"@storybook/react": "^5.3.19", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storybook requires packages, which throw the following errors:
tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
react-docgen-typescript-loader@3.7.2 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
react-docgen-typescript@1.20.4 requires a peer of typescript@>= 3.x but none is installed. You must install peer dependencies yourself.
We can install typescript@>= 3.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment from above; Storybook isn't currently on my priority list as we're not using it in a very effective way, yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typescript is also a requirement of material-ui, which this repo heavily depends upon. This is the one library that will provide the most stability if it's added to this PR @angelocordon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing anywhere in the Material UI docs that say we need Typescript in order to use Material UI. We've been able to use it this whole time without TS. I think perhaps you mean this page? I believe this only means that if we do have static typing in our codebase, we'd need at least TS 3.2 for it to work with Material.
Considering that this particular thread is about Storybook and we're now talking about Material, this is one of those opportunities where we can be much more practical and avoid some dependency pain points.
Thanks for the review @tgrrr - I think the peer dependency issues are... minor 🤷🏽 Curious if you started getting them from upping the React versions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is OK to merge in first, actually, since there are a couple of updates to make in #4!
The dependency requirements are based on this PR, without any changes implemented, including to React npm -v 6.14.5 With the current PR without any changes I have:
I understand that shaving the yak is tiresome, but I think there's a large chance of a new dev spending a significant amount of time trying to get this setup. |
Handle low vulnerability issue.
Thanks for the heads up @tgrrr. Something feels iffy with your local environment based on the description you're saying. I've removed node_modules and reinstalled the packages, and run the tests and everything seems to be in working order. I think the conflicts you're experiencing may not be related to this PR, but we should file an issue if they're persisting after a deeper investigation. |
Going ahead to merge this @tgrrr. If any of the discussion topics above need to be resolved further, let's discuss in our frontend channel, or if you continue to have technical issues, please write up an issue. |
What type of PR is this? (check all applicable)
Context
Update NPM packages to handle vulnerability issues. Also updated packages that are way behind on their versions.
Implementation Details - what was your thought process as you changed the code?
1/ To find packages that are currently vulnerable, run
npm audit
. Runningnpm audit --fix
can fix most of the issues. NPM itself (listed in our package.json) was not automatically fixed and had to be updated by runningnpm update npm@latest
.2/ Running
npm outdated
also gives us a list of packages that are way behind from their current release versions. Updated packages based on themes instead of updating all at once to see if it breaks anything. In between the package updates, I ran the tests to see if what we have still passed (although our test coverage is kind of lacking). While the packages were not updated to their latest available versions, their current versions listed here are considered "safe"; I suppose so long that we're not more than a whole version behind.Added tests?
Added to documentation (readme.md or contributing.md)?