The project is deprecated. Jarvis now uses Create React app's Custom Templates.
In order to migrate to a newer react-scripts
version:
yarn remove @guestyci/guesty-react-scripts
yarn add react-scripts@^5.0.1
yarn add babel-plugin-transform-react-qa-classes eslint-config-airbnb eslint-config-prettier react-app-rewired customize-cra --dev
- Create a file called
config-overrides.js
in the root of the project (where.eslint
,.gitignore
etc are) and copy-paste the following into it:
const {
override,
overrideDevServer,
addBabelPlugin,
addWebpackPlugin,
} = require('customize-cra');
const ContextReplacementPlugin = require('webpack').ContextReplacementPlugin;
const supportedLocales = [
'de',
'fr',
'hu',
'ja',
'it',
'es',
'nl',
'cs',
'da',
'el',
'hr',
'pl',
'ru',
'sk',
'pt-br',
'zh-cn',
];
module.exports = {
webpack: override(
// Remove moment locales opt out:
// https://github.com/facebook/create-react-app/blob/64df135c29208f08a175c941a0e94d9a56d9e4af/packages/react-scripts/config/webpack.config.js#L728
config => {
config.plugins = config.plugins.filter(
plugin => 'IgnorePlugin' !== plugin.constructor.name
);
return config;
},
addWebpackPlugin(
new ContextReplacementPlugin(
// eslint-disable-next-line no-useless-escape
/moment[\/\\]locale/,
new RegExp(
`[/\\\\](${supportedLocales
.map(locale => `${locale}(\\.js)?`)
.join('|')})$`
)
)
),
process.env.NODE_ENV !== 'production' &&
addBabelPlugin('babel-plugin-transform-react-qa-classes'),
process.env.NODE_ENV !== 'production' &&
process.env.PORT &&
function(config) {
config.output = {
...config.output,
publicPath: `http://localhost:${process.env.PORT}/`,
};
return config;
}
),
devServer: overrideDevServer(
process.env.REACT_APP_IN_LDE &&
function(config) {
config.headers = {
...config.headers,
'Access-Control-Allow-Origin': '*',
};
return config;
}
),
};
cat <<< $(jq '.scripts += {start:"ESLINT_NO_DEV_ERRORS=true react-app-rewired start", build:"react-app-rewired build"}' package.json) > package.json
- Upgrade
Circle CI
node docker image to version 12 (.circleci/config.yml
). If you don't mind which minor version it will have12.16.3
will work. - Upgrade
Circle CI
cypress docker image to version 12 (.circleci/config.yml
).
If you encounter any issue with the migration, please #contact-platform-fe
CLUSTER
and GUESTY_ENV
are no longer passed to the build.
Guesty's fork configurations for Create-react-app
For general knowledge please refer to - User Guide
On how to develop apps bootstrapped with Create React App.
There are multiple versions of the apps. Please take care of what and where you change
This is the most common usage of our tool provided to compliment our jarvis cli tool
branch name: feature/cli
To publish - run:
yarn publish --tag cli
For all the older apps which were not generated via the cli.
branch name: 'master'
To publish - run:
yarn publish
CRA apps are complex, the deployable section is the react-scripts
and ONLY the react-scripts
folder.
To deploy:
- clone the repo
- make your changes (to react-scripts)
- from react-scripts folder run :
yarn publish --tag cli
Periodically we might want to update our CRA fork and align it with the original (upstream) master.
Before you do that, Be EXTREMELY careful, we have made changes to CRA, make sure they are not overridden.
to update: with some sort of merge tool, compare upstream/master with our feature/cli.
Run the app locally and test it
only then push and deploy.