-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Move react
to peerDependencies
#5813
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,19 @@ module.exports = function upgrade(args, config) { | |
'https://github.com/facebook/react-native/releases/tag/v' + semver.major(v) + '.' + semver.minor(v) + '.0' | ||
) | ||
); | ||
|
||
// >= v0.21.0, we require react to be a peer depdendency | ||
if (semver.gte(v, '0.21.0') && !pak.dependencies['react']) { | ||
console.log( | ||
chalk.yellow( | ||
'\nYour \'package.json\' file doesn\'t seem to have \'react\' as a dependency.\n' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style suggestion: I often use template strings for messages so quotes don't have to be escaped There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ide I was just matching other places in the file. I guess I could update the whole file...are template strings supported everywhere now? (the local-cli isn't run through babel-register) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC they shipped with Node 4 |
||
'\'react\' was changed from a dependency to a peer dependency in react-native v0.21.0.\n' + | ||
'Therefore, it\'s necessary to include \'react\' in your project\'s dependencies.\n' + | ||
'Just run \'npm install --save react\', then re-run \'react-native upgrade\'.\n' | ||
) | ||
); | ||
return Promise.resolve(); | ||
} | ||
} else { | ||
console.log( | ||
chalk.yellow( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this respect the declared version of React via
peerDependencies
(0.14.5)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good question, might be worth installing the version we know matches react-native's one, we can get it from RN's package.json's peerDependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to reading the version from RN package.json