For a Meteor project I want to make changes to a Meteor Core library file.
Is this possible and if so, how?
So far I've tried just copying the files into my project directory hoping that the respective Objects are just overwritten from the originals but the problem herewith was that dependent functions or variables were only defined locally.
Then I tried to git clone
them into the project's packages
directory like you would do with a community package, but that didn't function either since the clone command failed (fatal: repository ... not found
) and also the package is not explicitly called in the .meteor/packages file.
Any idea?
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 mainmeteor/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:
or
git clone [email protected]:<username>/meteor.git
if you forked itpackages
directory) You can checkout the desired branch/commit and copy them to the localpackages
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:
for example:
cloning
ddp-client
from thedevel
branch:or from the
master
branch:Notes:
meteor add <package>
) if you haven't already.