How to force your version of a package as a dependency?

I made a fork of flow router and now I would like that Meteor uses that in my app for all dependencies of all packages I am using, which depend on kadira:flow-router. But even if I have api.imply('kadira:flow-router@2.10.0') in my package.js Meteor still loads kadira:flow-router as a dependency. The consequence is that I have now two routers in the app but routes are registered to only one, so I am getting errors like There is no route for the path: /.

It seems that the only way to go around this is to put a package inside packages directory. But this is exactly what I wanted to avoid by publishing my own fork of the package.

So, why doesn’t imply work and make it replace the dependency everywhere?

It seems to work with such dummy package but this is really overkill? Can this be automatized?

Can you not pin it down with @=?

Isn’t that just for pinning the version? I do not see how this could help here.

Oh now I see.

And your solution seems very clever.

I take a different approach. I fork the package to put it in my packages directory, don’t change the name, just increment the semver version number with _1 and then pin that version down as a dependency.

That way, the app does not check package server for that dependency. And any other package that depends on it out of my control also get to use my version.

Yes, I wanted to avoid the git submodule inside the packages. But it seems that is not possible.

Agreed, I don’t like submodules either. In fact when I fork a package, I delete anything git related in it so it is tracked directly from within my repository.

1 Like