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 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.
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
packages
directory)
ln -s ../../(...)/meteor/packages/You can checkout the desired branch/commit and copy them to the local
packages
directory instead, of course.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:
meteor add <package>
) if you haven't already.