redis-semaphore
redis-semaphore copied to clipboard
Allow non-ioredis client
This PR removes all ioredis imports from non-test code, and instanceof ioredis.Redis checks of redis clients.
Users can now use non-ioredis clients with this library, but are expected to provide ioredis-compatible API, marked by RedisClient type.
ioredis should work as before.
Fixes https://github.com/swarthy/redis-semaphore/issues/201 .
It is now possible to make ioredis an optional peer dep, with peerDependenciesMeta:
"peerDependenciesMeta": {
"ioredis": {
"optional": true
}
}
But it could be a breaking change so I'm not sure if we should. If user didn't have ioredis as explicit dependency this could break something in rare case.
@jokester Hi! Thanks for PR! Please, check review comments.
If user didn't have ioredis as explicit dependency this could break something in rare case.
I guest we can mark it optional and release minor version, because command in README.md already contains ioredis. So it was a conscious decision by the user not to install ioredis explicitly for that rare case.