Skip to content

Commit

Permalink
Change peerDependencies to optionalDependencies
Browse files Browse the repository at this point in the history
optionalDependencies dont spill a bunch of warnings on the screen. I use ioredis and it's reminding me to always install redis and redis-mock.

https://yarnpkg.com/lang/en/docs/dependency-types/

optionalDependencies
Optional dependencies are just that: optional. If they fail to install, Yarn will still say the install process was successful.

This is useful for dependencies that won’t necessarily work on every machine and you have a fallback plan in case they are not installed (e.g. Watchman).

PR: #280
  • Loading branch information
knoxcard authored and wavded committed Sep 2, 2019
1 parent f440378 commit 008fc43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "git@github.com:visionmedia/connect-redis.git"
},
"peerDependencies": {
"optionalDependencies": {
"ioredis": "^4.10.0",
"redis": "^2.8.0",
"redis-mock": "^0.46.0"
Expand Down

3 comments on commit 008fc43

@BorntraegerMarc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wavded @knoxcard isn't redis a peer dependency because it doesn't come bundled with the library anymore since v4.0?

@knoxcard
Copy link
Contributor Author

@knoxcard knoxcard commented on 008fc43 Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used to be a peer dependency, but it is now optional. Keeping library lightweight while giving the end user more flexibility.

You can use either:

  1. https://www.npmjs.com/package/redis
  2. https://www.npmjs.com/package/ioredis.

@wavded
Copy link
Collaborator

@wavded wavded commented on 008fc43 Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BorntraegerMarc Ugg... optionalDependencies has the behavior of installing them unless they fail to build so that was incorrect as well. We now do not specify optional or peer as neither is accurate and both lead to confusing messaging. The documentation on how to use the library wins in this case and is the clearest. package.json does not have a good way of describing what we are trying to say here.

Please sign in to comment.