Automattic / newspack-plugin

An advanced open-source publishing and revenue-generating platform for news organizations.
https://newspack.com
GNU General Public License v2.0
333 stars 49 forks source link

Replace old NPM packages #1218

Open dkoo opened 3 years ago

dkoo commented 3 years ago

Is your feature request related to a problem? Please describe.

1135 updates our Node version support to v16.11.1. This includes NPM v8. As of NPM v7, peer dependencies are installed by default. However, some of the packages we use have conflicting peer dependency requirements for an older version of React than we currently use (v17). As a result, we can only install our dependencies using npm i --legacy-peer-deps, which forces NPM to treat peer dependencies as they were treated in NPM v4–6 (we previously were running Node v12, which uses NPM v6).

Describe the solution you'd like The two packages I've seen throw build errors are react-daterange-picker and react-rte, both of which haven't been updated in over a year. Ideally we would replace these packages with more consistently maintained packages that don't have conflicting peer dependencies. There may also be other packages with peer dependency conflicts as well.

The ideal solution would be that we're able to run npm install commands without the --legacy-peer-deps flag.

Describe alternatives you've considered There's little risk in continuing to use these packages and the --legacy-peer-deps flag since they don't currently cause any issues. Both packages are also used for very specific areas of the plugin (the Campaigns Analytics tab and the Support ticket feature, respectively).

It's always possible, however, that these or other packages with peer dependency conflicts will cause build or code breakages with future package updates or new packages we might add. If that happens, we will be forced to replace these packages with non-conflicting packages.

adekbadek commented 2 years ago

Maybe npm got updated on CI, because this issue has just prevented and alpha release from building.

adekbadek commented 2 years ago

I've added --legacy-peer-deps flag to the shared CI config (code lives in newspack-scripts).

adekbadek commented 2 years ago

Update: we're not using react-rte anymore, so it's about react-daterange-picker now.

This issue can be closed if npm ci completes without error while on node version v16.11.1. If react-daterange-picker is uninstalled, it will – so replacing this package should fix the issue.