import { copyFile } from 'fs-extra' import { packageJson } from 'mrm-core' const reactAppTask: TaskExecution = async ({ getTaskPath, getTargetPath, copyFiles, installYarn, }) => { packageJson() .setScript('start', 'speedlo start') .setScript('validate', 'speedlo validate -tld') .save() await installYarn({ '@babel/core': '7.x', '@babel/plugin-syntax-dynamic-import': '7.x', '@babel/plugin-syntax-jsx': '7.x', '@lingui/babel-preset-js': '2.x', '@lingui/babel-preset-react': '2.x', '@lingui/cli': '2.x', '@lingui/loader': '2.x', '@lingui/macro': '2.x', '@speedlo/types': '2.x', '@speedlo/cli': '^2.x', '@types/lingui__core': '2.x', '@types/lingui__macro': '2.x', 'babel-core': '7.0.0-bridge.0', 'customize-cra': '^0.8', 'react-app-rewired': '2.x', 'webpack-bundle-analyzer': '3.x', }) await installYarn( { '@lingui/core': '2.x', '@lingui/react': '2.x', 'react-scripts': '^3.3.0', }, false, ) // uninstall(['@speedlo/config']) await copyFiles('config-overrides.js', '.linguirc') await copyFile( getTaskPath('service-worker-updater.js'), getTargetPath('public/service-worker-updater.js'), ) } reactAppTask.description = 'Setup CRA for Speedlo with Lingui support' export default reactAppTask