salsita / prism

React / Redux action composition made simple http://salsita.github.io/prism/
495 stars 24 forks source link

Peer dependencies? #48

Closed dalgard closed 8 years ago

dalgard commented 8 years ago

How come redux-saga and rxjs are peer dependencies of redux-elm?

If the latter imports the former somewhere in the code, shouldn't they just be regular dependencies?

zetoke commented 8 years ago

You can control version of your sagas or rocks in your app.

dalgard commented 8 years ago

Is "rocks" slang for Rx observables?

This doesn't really answer my question. Why are they peer dependencies? If I decide to use either, I will simply add them as dependencies to my own project, just like redux-elm should add them as dependencies to it.

tomkis commented 8 years ago

I think @zetoke made the point albeit didn't explain it properly.

None of them are dependencies since technically you don't even need to use them, unless you want to use Sagas (redux-saga / rxjs). Generally if you are developing a library, you want to give a user full control over installed dependencies, so that we don't restrict user to have installed two versions just because redux-elm enforces different version than their application.

zetoke commented 8 years ago

Is "rocks" slang for Rx observables?

@dalgard sorry, my fault. It does not slang. Auto-correction on my phone has corrected from rxjs to rocks :disappointed:

dalgard commented 8 years ago

@tomkis1 Thanks. So it comes down to avoiding an extra version. It's unfortunate that it shows up as a warning in the console, since it gives the impression that I'm doing something wrong, even when I don't need the two libs.

@zetoke It kinda makes sense as a slang word, though :)

tomkis commented 8 years ago

@dalgard well actually, you should install those two dependencies to avoid the warning, because either way sooner or later you will get to the point when sagas come handy ;-)

dalgard commented 8 years ago

No doubt – I would argue that any real-world app need a saga. Communicating correctly is important, though.

Avoiding the bundling of two different versions of the same package in one app is probably something that should be done manually when optimizing the bundle size, anyway?

dalgard commented 8 years ago

I'm thinking that the peer dependency feature isn't used all the time for a good reason.

Also, what about RxJS? I probably won't be using observables in my app, however great they are.

tomkis commented 8 years ago

So what do you suggest @dalgard should we put redux-saga and redux-saga-rxjs in dependencies instead?

dalgard commented 8 years ago

Only if they are actually used somewhere in redux-elm.

I can't figure out what relationship redux-elm have to these two libraries – the contents of this folder puzzles me.

tomkis commented 8 years ago

Maybe, but I'd still prefer to give user a chance to choose the right version of redux-saga and rxjs because they will most likely have these libraries already and the last thing we want is same library in different versions.