Meteor allows having local packages in a project, including ones that override existing (community or core) packages.
While overriding a community package locally often simply requires cloning (or extracting or adding as submodule) the GitHub repository into the /packages
folder, core packages currently live inside sub-directories of the main meteor/meteor
repository, which makes cloning them trickier.
Overriding a core package may require you to manually apply changes to the package as Meteor or the package update (as Meteor used to be dependent on specific package versions).
Therefore, before taking such step, make sure that you actually need to do it.
Make sure that you cannot you make your changes using local files or your own local package (e.g, by wrapping or replacing a function or monkey-patching it).
There are a few approaches that I used in order to override a core package.
Clone the entire repository and link the directories
This is useful if you want to contribute your changes to the project. You should probably fork the repository and clone your own fork.
Clone the meteor repository:
git clone https://github.com/meteor/meteor.git
or
git clone git@github.com:<username>/meteor.git
if you forked it
- Link the package directory (in your project's
packages
directory)
ln -s ../../(...)/meteor/packages/
You can checkout the desired branch/commit and copy them to the local packages
directory instead, of course.
Statically download only the package directory
There is a neat trick that allows you to download a given directory from GitHub using svn
.
This is obtained by issuing:
svn export https://github.com/meteor/meteor/[trunk|branches/]/packages/
for example:
cloning ddp-client
from the devel
branch:
svn export https://github.com/meteor/meteor/branches/devel/packages/ddp-client
or from the master
branch:
svn export https://github.com/meteor/meteor/trunk/packages/ddp-client
Notes:
- As mentioned earlier, you may need to manually apply changes if you update Meteor.
- Don't forget to add the package to the project (
meteor add <package>
) if you haven't already.
- Meteor is expected to switch to NPM at some point (possibly in Meteor v1.5), so make sure to use the methods specified in this answer only for meteor's own packaging system.