Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react and react-dom dependencies should have caret range #1663

Closed
gaearon opened this issue Feb 27, 2017 · 9 comments
Closed

react and react-dom dependencies should have caret range #1663

gaearon opened this issue Feb 27, 2017 · 9 comments
Milestone

Comments

@gaearon
Copy link
Contributor

gaearon commented Feb 27, 2017

I think #1253 made it so that react and react-dom are also installed with exact range:

  "dependencies": {
    "react": "15.4.2",
    "react-dom": "15.4.2"
  },
  "devDependencies": {
    "react-scripts": "0.9.2"
  },

This is not right. We want to pin react-scripts but leave react and react-dom unpinned:

  "dependencies": {
    "react": "^15.4.2",
    "react-dom": "^15.4.2"
  },
  "devDependencies": {
    "react-scripts": "0.9.2"
  },

The easiest way to do it would probably be to remove the exact flag from the installation script in packages/create-react-app/index.js, and instead pin react-scripts to a specific version in the same function that moves react-scripts to devDependencies (also in that file).

@johann-sonntagbauer
Copy link
Contributor

johann-sonntagbauer commented Feb 27, 2017

@gaearon it is kinda wired.
Initializing a project with create-react-app will install the dependencies with exact flag which was introduced with #1253
BUT
there also exists an init script (https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/scripts/init.js) which will install the dependencies without the exact flag. Is that init script needed at all any more?

@johann-sonntagbauer
Copy link
Contributor

my suggestion would be as you already mentioned to remove the exact flag and pin react-scripts version AND remove the code path in the init.js

@gaearon
Copy link
Contributor Author

gaearon commented Feb 27, 2017

The init script only does this for backwards compatibility with older global CLIs. It is still necessary because we want older CLIs to keep working.

@johann-sonntagbauer
Copy link
Contributor

thx for clearing that up. One additional question, there exists some mechanism to install additional dependencies listed in a templates.dependeny.json file That mechanism is obsolete?

@Timer
Copy link
Contributor

Timer commented Feb 27, 2017

No, that that code is used for our kitchensink e2e.

@johann-sonntagbauer
Copy link
Contributor

ok :) lots to learn here

Tried out some variants with installing different versions with npm and it seems that it is not possible to install with different modes during an single install. The dependecies will be downloaded and installed with the correct version pattern, but the dependencies in the package.json will all get the same version range.

e.g.

npm install react@^15.0.0 react-dom@^15.0.0 react-scripts@0.9.1 --save
  "dependencies": {
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "react-scripts": "^0.9.1"
  }

npm install react@^15.0.0 react-dom@^15.0.0 react-scripts@0.9.1 --save --save-exact
  "dependencies": {
    "react": "15.4.2",
    "react-dom": "15.4.2",
    "react-scripts": "0.9.1"
  }

One way to solve that would be to patch the package.json upfront and afterwards trigger an install.

@gaearon
Copy link
Contributor Author

gaearon commented Feb 27, 2017

Yes, we already patch up package.json after install so I just suggest adding an extra character there.

@johann-sonntagbauer
Copy link
Contributor

THX that will be a perfect spot. Try to formulate a PR.

@Timer
Copy link
Contributor

Timer commented Mar 1, 2017

Fixed in #1669. Thanks @johann-sonntagbauer!

@Timer Timer closed this as completed Mar 1, 2017
@gaearon gaearon added this to the 0.9.3 milestone Mar 1, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants