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 intlShape prop-type and have to do some busy work to accommodate that, but we gain the useIntl hook. It feels like a win! (STRIPES-672)
    • In package.json, update the react-intl version to ^4.5.1.
    • The intlShape prop-type is no longer available; replace it with PropTypes.object and 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 use react-intl-safe-html for cases of b, i, em, strong, span, and div without  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 moment to a peerDependency makes certain that the same instance, configured by stripes with the current locale, is available to all modules. (STRIPES-635)
    • Move moment from dependencies to peerDependencies in your package.json file. That's it!