Created by: n3tr
to fixes #1239 (closed)
Current Scenario
-
create-react-app my-app
will invokescreate-react-app/index
to create app folder,package.json
and installreact-scripts
as devDependencies (--save-dev
). (Use latest version if not specific). - Use
react-scripts
to init project and installreact
andreact-dom
as dependencies (--save
)
New
-
create-react-app/index
create app folder,package.json
, and installreact
,react-dom
, andreact-scripts
as a dependencies (--save
) at the same time. - Since
react-scripts
should be in devDependencies, we modify the package.json to move it to devDependencies. - Use
react-scripts
to init project and check if there'rereact
andreact-dom
have been installed yet. If noreact
andreact-dom
insidenode_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-app
withreact-scripts
-
Expected result:
- Install
react
,react-dom
, andreact-scripts
at the same time (by CRA)
- Install
Old CRA + new react-scripts
-
Test Scenario: Use old
create-react-app
with newreact-scripts
-
Expected result:
- Install
react-scripts
by CRA then installreact
andreact-dom
byreact-scripts
- Install
New CRA + old version of react-scripts
-
Test Scenario: Use new
create-react-app
with oldreact-scripts
-
Expected result:
- Install
react
,react-dom
, andreact-scripts
by CRA. - And install
react
andreact-dom
again byreact-scripts
.
- Install