Skip to content

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

Description

@gaearon

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).

Activity

  1. johann-sonntagbauer commented on Feb 27, 2017

    @johann-sonntagbauer
    Contributor

    @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?

  2. johann-sonntagbauer commented on Feb 27, 2017

    @johann-sonntagbauer
    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

  3. gaearon commented on Feb 27, 2017

    @gaearon
    ContributorAuthor

    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.

  4. johann-sonntagbauer commented on Feb 27, 2017

    @johann-sonntagbauer
    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?

  5. Timer commented on Feb 27, 2017

    @Timer
    Contributor

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

  6. johann-sonntagbauer commented on Feb 27, 2017

    @johann-sonntagbauer
    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.

  7. gaearon commented on Feb 27, 2017

    @gaearon
    ContributorAuthor

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

  8. johann-sonntagbauer commented on Feb 27, 2017

    @johann-sonntagbauer
    Contributor

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

  9. Timer commented on Mar 1, 2017

    @Timer
    Contributor

    Fixed in #1669. Thanks @johann-sonntagbauer!

  10. added this to the 0.9.3 milestone on Mar 1, 2017
  11. locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions