Created by: n3tr
to fixes #1239 (closed)
Current Scenario
-
create-react-app my-appwill invokescreate-react-app/indexto create app folder,package.jsonand installreact-scriptsas devDependencies (--save-dev). (Use latest version if not specific). - Use
react-scriptsto init project and installreactandreact-domas dependencies (--save)
New
-
create-react-app/indexcreate app folder,package.json, and installreact,react-dom, andreact-scriptsas a dependencies (--save) at the same time. - Since
react-scriptsshould be in devDependencies, we modify the package.json to move it to devDependencies. - Use
react-scriptsto init project and check if there'rereactandreact-domhave been installed yet. If noreactandreact-dominsidenode_modules, install them. (this would happen when user use old CRA to create project and receive the latest version of react-scripts)
This should backward compatible with old version of CRA, in case user use previous version of CRA which won't install react and react-dom along with react-scripts.
Test plans
Both new version
-
Test Scenario: Use new
create-react-appwithreact-scripts -
Expected result:
- Install
react,react-dom, andreact-scriptsat the same time (by CRA)
- Install
Old CRA + new react-scripts
-
Test Scenario: Use old
create-react-appwith newreact-scripts -
Expected result:
- Install
react-scriptsby CRA then installreactandreact-dombyreact-scripts
- Install
New CRA + old version of react-scripts
-
Test Scenario: Use new
create-react-appwith oldreact-scripts -
Expected result:
- Install
react,react-dom, andreact-scriptsby CRA. - And install
reactandreact-domagain byreact-scripts.
- Install