Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates sharetribe-scripts to the next major version.
sharetribe-scripts is a fork of Create React App (CRA) repository and specifically react-scripts is modified to support server-side rendering, code-splitting, and certain PostCSS plugins that we chose to include years ago. (E.g. introduced CSS Modules before CRA took the same approach.)
This update is actually an update from CRA 4.0.2 to v5.0.1
The breaking changes are in v5.0.0
Note: we haven't explored Tailwind support since it would mean a complete rewrite for the FTW templates. In addition, CSS Modules make it easier for customizers to learn a big codebase like FTW (i.e. which component is responsible for a different sections of DOM, etc.).
Consequences
Major updates to Webpack (v4 > v5) and PostCSS (v7 > v8), were the most worksome for FTW templates.
The upper restriction of Node.js engine "version earlier than v17" has been lifted!
Loadable components was updated
You should add
@import
for customMediaQueries.css file.@import '../../styles/customMediaQueries.css';
src/index.js was refactored.
(The order of classes in CSS files affects declaration overrides.)
postcss-apply plugin is not working anymore
It's been deprecated for a long time because W3C decided to not go forward with that feature suggestion
You should migrate away from postcss-apply syntax (aka CSS Property Sets)
However, we have introduced a naive custom version of postcss-apply as a private plugin to give more time to migrate away.
Most of the previous CSS Property Sets are turned into CSS classes in the marketplaceDefaults.css file.
So, most of the time the change is minimal:
Unfortunately, there's one problem that doesn't make it that straightforward. The order of the plain CSS classes in the marketplaceDefaults.css file defines which classes override each other. (The composes feature just includes those class names to DOM element - not their content.) Therefore, if multiple @apply rules are used inside the CSS module class, you need to check if there are overwrites between declarations of those Sets.
Button styling included almost always some overrides. We decided to split buttons styles into smaller chunks that can be combined:
New syntax:
This might be a bit controversial, but it introduces fewer CSS overrides. Of course, you are free to customize this to your liking.
Potential issues that you might encounter if taking an update from upstream
Old version of @babel/runtime
Redux has sub-dependency to @babel/runtime. An old version of that package doesn't handle ES Modules well. You might need to call
yarn upgrade redux
afteryarn install
to update Redux sub dependencies to the latest in yarn.lock file.reduxjs/redux#4174
customMediaQueries.css was not @imported in the file that uses them
You should be able to find correct files by grepping files that don't contain "customMediaQueries" but which contain "--viewport".
In OSX, that could be done in Terminal with:
Missing propertySets.css file and your custom CSS Property Sets
You should consider if you want to refactor your custom @apply rules (i.e. migrate away as recommended) or reintroduce / revert the deletion of the propertySets.css file.
Wrong syntax for CSS Property Sets (postcss-apply)
Some of the definitions of CSS Property Sets in the FTW codebase used a wrong syntax to define them. The previous way how PostCSS v7 parsed CSS files to the AST (Abstract Syntax Tree) didn't care about that, but PostCSS v8 changed the parsing logic.
🚫 Invalid:
✅ Valid:
You should only face this issue if you continue to use CSS Property Sets. However, you should consider them as deprecated and migrate away.
There are a couple of warnings with
yarn run dev
This is hopefully fixed in the next release:
facebook/create-react-app#11862