magicgregz
magicgregz

Reputation: 7679

how to use a fork of a meteor package when the original package is a dependency

Context

I'm using the aldeed:autoform package and found a couple bugs & filed PR for it(https://github.com/aldeed/meteor-autoform).

Aldeed being the only maintainer of a lot of popular packages ends up being the bottleneck for merging PR & following up with issues. My solution was to fork his project & published my fork on atmosphere.

Naively, i just removed his package meteor remove aldeed:autoform and tried to add mine: meteor add metakungfu:autoform

When i load my app, i get the following error: enter image description here

Package['aldeed:autoform'] returns the expected object, even though i removed the package.

For sake of completeness, i do use a bunch of other packages that depends on aldeed:autoform and my guess is that this is the reason why aldeed:autoform package is still present.

Questions:

Upvotes: 1

Views: 346

Answers (3)

magicgregz
magicgregz

Reputation: 7679

I've end up using mgp to manage the packages. In order to solve my problem, i had to do two things:

First, add a git-packages.json in the root of your project that looks like this:

➜ cat git-packages.json
{
  "aldeed:autoform": {
    "git": "[email protected]:gregory/meteor-autoform.git",
    "branch": "dev"
  }
}

This will work locally, but if you deploy to heroku, the buildpack will need to install mgp & install the dependencies.

I just opened a PR to fix this

Upvotes: 1

ghybs
ghybs

Reputation: 53290

Instead of publishing your own version of aldeed:autoform onto Atmosphere, you should rather use it as a local package, keeping its name intact. Meteor will look first for your local packages, before trying to fetch from Atmosphere.

That way, all your other packages that depend on it will use your local version.

To do that, see: Why does Meteor's aldeed/meteor-tabular package get stuck processing and never render a result?

Reference: Meteor Guide > Build > Writing Atmosphere Packages > Overriding packages with a local version

Upvotes: 0

Adam Silverthorne
Adam Silverthorne

Reputation: 1

Fork all the dependencies and make them point to your fork.

Upvotes: 0

Related Questions