Skip to content

Commit

Permalink
deps: Fix peer dependency warning with expo-application.
Browse files Browse the repository at this point in the history
On expo-application v2.1.0 (see 18c37ce), we were seeing this
warning on initial runs of `yarn`:

warning " > expo-application@2.1.0" has unmet peer dependency "@unimodules/core@~1.0.0".

(Same as in 5b6014e: "No such warning if `yarn` stops after step
'Resolving packages' and prints 'Already up-to-date'; but if it has
any actual work to do, it always shows this warning in step 'Linking
dependencies'.)

Version 2.1.0 of expo-application declares that it depends on a
version of @unimodules/core (1.0.0) that was already several months
out-of-date at the time expo-application was first created, and it
seems unlikely that this was well-considered.

I filed expo/expo#7728 for this, and it
was promptly addressed by releasing version 2.1.1 of
expo-application that had "*" for its version constraint on the
@unimodules/core peer dependency.

So, switch to that new version.

Even when we do that, though, we get the following:

warning " > expo-application@2.1.1" has unmet peer dependency "@unimodules/core@*".

This goes away when we declare a version of @unimodules/core in our
own dependencies, though. Greg did some digging and concluded that
this is likely what we're supposed to do, actually, because it's
declared as a "peer dependency":

"""
Here's the reference doc for it:
https://docs.npmjs.com/files/package.json#peerdependencies but it's
not very clear about what it actually *means* -- mostly it just
describes a use-case.

The closest I've found to clear docs on it may be this Yarn blog
post:
https://classic.yarnpkg.com/blog/2018/04/18/dependencies-done-right/

> The `peerDependencies` object guarantees that, for each entry, any
> package that requires you will be requested to provide a copy of
> the dependency listed here, ideally matching the version you
> requested. It also guarantees that you’ll be able to access this
> dependency through `require()`, and finally **it also guarantees
> that the return of `require()` will be exactly the same version &
> instance than the one your parent would obtain if they were to
> `require()` it themselves**. [emphasis in original]

And if you work through the consequences of that... it means in
particular that the "parent" has to have that dependency and be able
to `require()` it themselves.

Which, if you're declaring your dependencies cleanly, means the
parent should have it as a dependency in their own `package.json`.
"""

So, declare @unimodules/core in our own "dependencies", with the
version specified by react-native-unimodules in its active version.
This matching should be done each time we change versions of
react-native-unimodules.
  • Loading branch information
Chris Bobbe committed Apr 10, 2020
1 parent 75f4946 commit bc27f2d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- boost-for-react-native (1.63.0)
- DoubleConversion (1.1.6)
- EXApplication (2.1.0):
- EXApplication (2.1.1):
- UMCore
- EXAppLoaderProvider (7.0.0)
- EXConstants (7.0.1):
Expand Down Expand Up @@ -292,7 +292,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
DoubleConversion: bb338842f62ab1d708ceb63ec3d999f0f3d98ecd
EXApplication: 777c2f1742b381725b3e8c1da41f0113ebfd4694
EXApplication: 7cf81de6fafccff42f5d1caa5c24a159db6b9437
EXAppLoaderProvider: 5d348813a9cf09b03bbe5b8b55437bc1bfbddbd1
EXConstants: 857aa7b1c84e2878f8402d712061860bca16a697
EXFileSystem: 7e53a2c30a2eb6987ba6d5158ab908f947523228
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
"@react-native-community/async-storage": "^1.6.3",
"@react-native-community/netinfo": "^3.2.1",
"@sentry/react-native": "^1.0.9",
"@unimodules/core": "~4.0.0",
"@zulip/shared": "^0.0.2",
"base-64": "^0.1.0",
"blueimp-md5": "^2.10.0",
"color": "^3.0.0",
"date-fns": "^1.29.0",
"expo-application": "^2.1.1",
"katex": "^0.11.1",
"expo-application": "^2.1.0",
"lodash.escape": "^4.0.1",
"lodash.isequal": "^4.4.0",
"lodash.omit": "^4.5.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3627,10 +3627,10 @@ expo-app-loader-provider@~7.0.0:
resolved "https://registry.yarnpkg.com/expo-app-loader-provider/-/expo-app-loader-provider-7.0.0.tgz#9bfff831a204d0a8896e0120bce2209c4304ef03"
integrity sha512-C+5zpZN2T7PCj7weLs/ZgAC+y9dvu0VdTXD00Jf9Wo7Pxu/lsLh6ljg9JL91c+2tYDzMEODPNmT+JOUIxAr5zQ==

expo-application@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/expo-application/-/expo-application-2.1.0.tgz#ce5b13f025643e26478e5f7e4a89f21e96b2f908"
integrity sha512-JuWpToRjx81mNwJCL80Rf7wbEcNgyapqcfB3Iz1kqDSK8mF7ZmLL05dmdvPrqfGdhJImbMlDS4MTZU9ArUTZuQ==
expo-application@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/expo-application/-/expo-application-2.1.1.tgz#7cd61ccc53d7a0c85c8aac64b5ea59b20a1cb803"
integrity sha512-iq24Zgd4EmbFakHL2saVdA2zexhRX80RSbAtrWrp3BaVDd7yFNAtcwjW4r1Oyhm00YEREWp70sTaXrWs6jKHQA==

expo-asset@~7.0.0:
version "7.0.0"
Expand Down

0 comments on commit bc27f2d

Please sign in to comment.