This release contains many important internal changes that improve security, TypeScript support, framework development CI/CD, and upgrades necessary to prepare for a future v1 release candidate (e.g. upgrading to React v17).
Thank you to all the amazing contributors who are keeping the PRs rolling! Redwood is amazing because of you 🎉
⚠️ This release contains Breaking Changes and requires code modifications. See the "Breaking" and "How to Upgrade" sections for more information.
Changed
- ℹ️ Bump CRWA Node.js Engine requirement from 12 to 14 (#1946) 5dbb9e0 @thedavidprice
- Replaces Flash with react-hot-toast (#1856) 4a899b5 @cannikin
- see new Toast Notifications Doc
- ⚠️Deprecation Warning: see "Breaking" section below
- Router Docs - Remove idea of sharing router outside of Redwood (#1900) 624b0d5 @andrew-hwahin
- Port test-tutorial script to JS (#1896) df8d0c2 @dac09
- ⚠️ Upgrade React to v17. (#1705) f586198 @peterp
- ⚠️ Upgrade to Prisma v2.18.0 (skipping v2.17.0) (#1851) 9f62208 @thedavidprice
- Contains changes that may be "Breaking" for some projects. See “Breaking” section below.
Added
- Add rw cli tests to e2e (#1932) b0de879 @dac09
- Allow prerendering NotFoundPage as 404.html (#1891) 1ebcee6 @dac09
- Move ts-to-js from 'rwt' to 'rw'. (#1943) 57a14a0 @peterp
- Switch create-redwood-app template to TypeScript (#1810) 91cef20 @peterp
- Make storybook configurable in a redwood app (#1828) 751d342 @jtoar
- Add per request global context (#1789) 148aa46 @peterp
- Add Cypress workflow (#1895) 9f87e1e @peterp
- Add Cypress Step7 Test (#1882) bcc8dd2 @wafuwafu13
- Run a diagnostic check when prerender fails #1962 @dac09
Fixes
- i18n Setup : Simpler configuration + examples (#1847) 42ec5eb @simoncrypta
- Fix/rwt link on canary (#1939) 3843722 @dac09
- Adds resolution to template, to prevent module duplication in web/node_modules (#1933) a86fea3 @dac09
- Update service generator to use Prisma namespace (#1853) 437eefb @o0charlie0o
- Fixes 1902 to rwt link when path has spaces/parens (#1903) 0f4126c @dthyresson
- Fixes marshalling datetimes in and out of forms (#1906) f39a8bb @cannikin
- Rename scenario.* to scenarios.* (#1885) 74ca3bd @jvanbaarsen
- Lazily create AsyncLocalStorage when needed #1994 @Tobbe
Breaking ⚠️
Upgrading React and adding a package resolution
As of this version, Redwood is using React v17.0.1. However, other dependencies, e.g. Storybook, use a different version of React. This results in packages being duplicated and hoisted into web/node_modules
, which breaks unexpected things.
Projects need to bump their version of React. Additionally, to avoid duplication and hoisting, the solution is to add a package resolution. See the “How to upgrade…” section below.
Bumping Node.js Engine to v14
Technically this is not (yet) a breaking change. We are bumping Redwood’s Node.js requirement to Node.js v14 (from v12) and strongly encourage you to make the change now in your project. See “How to upgrade…” section below.
Replace Flash with React Hot Toast [deprecation warning]
This release replaces our custom Flash stuff with react-hot-toast
and updates the scaffold generators to generate with the new interface. Importing Flash will give a deprecation warning. Flash will be fully deprecated in Redwood v1 release.
Migration to react-hot-toast
is not required yet unless you are using dismissMessage()
and cycleMessage()
, which will now be a noop and you'll just see the deprecation notice.
See more information and a guide here for switching from Flash to Toaster.
Prisma Changes that may affect some projects
Prisma Type Mapping
Type mapping from Prisma schema to the database for Float
has changed from Decimal
to Double
in MySQL and PostgreSQL. Check out this video guide, which covers how to upgrade and address the remapping of Float.
Breaking changes due to strict type diffing and native types
Prisma no longer allows the loose mapping of Prisma scalar types to database column types without the specific notation. For more info, see Prisma v2.17.0 Release Notes
How to upgrade to Redwood v0.27 from v0.26
👉 IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.
Manual Code Modifications
Step 1: React upgrade and resolutions
In your root package.json
, add the following resolutions (see also this reference code):
+ "resolutions": {
+ "react-dom": "17.0.1",
+ "react": "17.0.1"
+ }
Depending on what Redwood version your project started on, there might be other lower priority changes to
./package.json
. Now might be a good time to inspect the current create-redwood-app package.json template code here and make other updates if needed.
And in your web/package.json
, make sure react
and react-dom
in your dependencies are at the correct version (see also this reference code):
- "react-dom": "^16.13.1",
- "react": "^16.13.1",
+ "react": "17.0.1",
+ "react-dom": "17.0.1",
Then run:
yarn install
👉 Note: When running
yarn install
during and after the upgrade you will see several warnings that are expected and safe to ignore:
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
warning Resolution field "react@17.0.1" is incompatible with requested version "react@^16.8.3"
warning Resolution field "react@17.0.1" is incompatible with requested version "react@^16.8.3"
warning Resolution field "react-dom@17.0.1" is incompatible with requested version "react-dom@^16.8.3"
warning Resolution field "react@17.0.1" is incompatible with requested version "react@^16.8.3"
warning Resolution field "react-dom@17.0.1" is incompatible with requested version "react-dom@^16.8.3"
warning Resolution field "react@17.0.1" is incompatible with requested version "react@^16"
Step 2: Running your app on Node.js v14.x
In your root package.json
, make the following change (see also this reference code):
+ “engines”: {
- "node": ">=12”,
+ "node": ">=14",
+ }
Check if the file .nvmrc
exists in your project root. If not, create it. Then add the following, which is a configuration option to use the lates LTS version of Node.js, which is currently v14.x. (see also this reference file):
lts/*
If you are deploying on Netlify or Vercel, the .nvmrc
will automatically configure the build environment to use Node.js v14.x. There is an additional setting on Vercel you may change in Settings/General/“Node.js Version”. However, the .nvmrc
file will take precedence.
Upgrade Packages
👉 IMPORTANT: In this version, upgrading packages is a two-step process. Please complete both steps to ensure you’ve resolved any possible issues with React package duplication.
Step 1
Run the following command within your App's directory:
yarn rw upgrade
Step 2
Once the upgrade is complete, inspect the Web workspace for web/node_modules
. If this directory is present (it most likely will be), remove it:
rm -rf web/node_modules
This command works for Mac and Linux. For Windows, use the applicable shell command to delete the directory and its contents.
Lastly, run a force install:
yarn --force
Confirm there are no duplicate react
, react-dom
, or core-js
packages in web/node_modules
(which might not exist at all). If you have questions about this process or need help, see this forum topic.
Need other help or having trouble upgrading packages? See this forum topic for manual upgrade instructions and general upgrade help.