node-ractify icon indicating copy to clipboard operation
node-ractify copied to clipboard

ractive as a dependency

Open weilu opened this issue 11 years ago • 4 comments

Why is ractive a devDependencies instead of dependency? In my project I have to manually install ractive. The bigger problems is when I upgrade ractify, ractive's version is out of date. Why not have npm manage it by moving ractive into dependencies instead?

weilu avatar Aug 07 '14 05:08 weilu

The intention is so you can upgrade ractive without my having to release an update to ractify each time.

marcello3d avatar Aug 07 '14 05:08 marcello3d

What about specifying ractive ~0.5.0? which will allow any version of ractive >=0.5.0 <0.6.0 -- it means user can use any ractive version falls under that range without you having to update ractify.

weilu avatar Aug 07 '14 05:08 weilu

I've gone back and forth on this.

The issue I ran into when I did it that way is that your project also needs to depend on ractive in order to require the ractive runtime.

If a different version gets installed in ractify, from your project (e.g. if you install ractify first, then add ractive, then update your ractive later on), you'll get conflicts.

Originally to avoid that, I exposed ractify's ractive version through an export, but that gets confusing when you don't realize that (and install ractive anyway, causing the conflict above). Plus you don't have any control over which ractive version gets installed.

I don't think there's a great solution, but the current one works for me.

marcello3d avatar Aug 07 '14 16:08 marcello3d

I think ractive should be considered a dependency of ractify. If my app is using ractify, I don't expect to directly include ractive as a dependency. It's like uglify and uglifyify: https://github.com/hughsk/uglifyify/blob/master/package.json#L11. And perhaps require('ractive/runtime') is where it starts to get messy. I'm of the opinion that ractify should require('ractive/runtime') and export it as ractify. That way, ractive as a dependency is transparent to app developers.

If a different version gets installed in ractify, from your project (e.g. if you install ractify first, then add ractive, then update your ractive later on), you'll get conflicts.

If one installs ractify, one shouldn't need to install ractive. If they do, they are looking for trouble. I don't think it's your responsibility as a library author to save those from themselves.

Plus you don't have any control over which ractive version gets installed.

You do if you specify a range in package.json. In this case, ractify 0.5.x requires ractive ~0.5.0, ractify 0.4.x requires ractive ~0.4.0.

weilu avatar Aug 07 '14 16:08 weilu