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

fix(gatsby-cli): add handling to ensure CLI uses same react instance across the board #21508

Closed
wants to merge 7 commits into from

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Feb 16, 2020

Couple of changes here:

  • minimize required react version - keeping react dep in gatsby-cli as latest version of gatsby will often cause multiple react instances being installed in node_modules (if react version defined by user doesn't satisfy this requirement
  • use react instance that will be used by ink for our components to prevent multiple react versions being used for same root

TO-DO:

  • Disable renovate bumping react version in gatsby-cli
  • Vendor ink-spinner
  • Add some automated checks to prevent breaking this structure in the future (eslint rules for restricted modules / imports)

Fixes #19827

…nimal supported version to decrease changes of duplicate react instances being installed in projects
@pieh
Copy link
Contributor Author

pieh commented Feb 16, 2020

ok, this isn't working - npm just seems to not be able to correctly build node_modules hierarchy that would satisfy peerDependencies:

npm WARN ink@2.7.1 requires a peer of react@>=16.8.0 but none is installed. You must install peer dependencies yourself.

while gatsby-cli have following in deps:

    "ink": "^2.6.0",
    "react": "^16.8.0",

and react >= 16.8 is being installed (somewhere in node_modules):

gatsby-shopify-starter@0.1.0 /Users/misiek/test/marcuswelds-gatsby-test
├─┬ UNMET PEER DEPENDENCY gatsby@2.19.18-cli-react-from-ink.35
│ └─┬ gatsby-cli@2.8.30-cli-react-from-ink.162
│   └── UNMET PEER DEPENDENCY react@16.12.0 
└── react@16.7.0 

@pieh pieh added the status: blocked This issue/PR can't be solved at the moment and shouldn't be closed/merged label Feb 17, 2020
@pieh
Copy link
Contributor Author

pieh commented Feb 17, 2020

I'll close this PR and open new one with just renovate changes and lowering gatsby-cli minimal react version requierment - this should alleviate the npm issue if user has react version satisyfing >=16.8.0 constraint.

We will still need to follow up on cases where user's react version is <16.8 (but will leave more information about that in the issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked This issue/PR can't be solved at the moment and shouldn't be closed/merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ambiguous "StoreStateProvider" error for all gatsby commands
2 participants