Stripes v4 migration guide
react-intl migration from v2 to v4
Migrating the peerDependency react-intl from v2 to v4 is a breaking change that requires some small but crucial changes. In short, we lose the
intlShapeprop-type and have to do some busy work to accommodate that, but we gain theuseIntlhook. It feels like a win! (STRIPES-672)In
package.json, update thereact-intlversion to^4.5.1.The
intlShapeprop-type is no longer available; replace it withPropTypes.objectand remove the import.Translation values with attributes in translations are no longer supported. See this ui-developer PR for an example of replacing a link with a translation using react-intl-safe-html with one using straight up
react-intl. You may still usereact-intl-safe-htmlfor cases ofb, i, em, strong, span, anddivwithout attributes.React's legacy context API is no longer supported; if you were using it, use injectIntl instead.
The following shell commands should take care of most prop-types changes:
find ./src -type f -name \*js | xargs perl -pi -e 's/intl: intlShape.isRequired/intl: PropTypes.object/g'find ./src -type f -name \*js | xargs perl -pi -e 's/intl: intlShape/intl: PropTypes.object/g'find ./src -type f -name \*js | xargs perl -pi -e 's/ intlShape,\n//g'
moment will become a peerDependency
Migrating
momentto a peerDependency makes certain that the same instance, configured by stripes with the current locale, is available to all modules. (STRIPES-635)Move
momentfromdependenciestopeerDependenciesin yourpackage.jsonfile. That's it!