如何覆盖项目中的流星核心包? [英] How to Override Meteor Core Packages in a Project?

查看:115
本文介绍了如何覆盖项目中的流星核心包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Meteor项目,我想更改Meteor Core库文件。

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.

然后我试着 git clone 将它们放入项目的 packages 目录中,就像使用社区包一样,但是由于clone命令失败(致命:存储库...未找到),并且未在.meteor / packages文件中显式调用包。

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.

任何想法?

推荐答案

Meteor允许在项目中使用本地包,包括覆盖现有包的包(社区或核心)包。

Meteor allows having local packages in a project, including ones that override existing (community or core) packages.

虽然在本地覆盖社区包通常只需要将GitHub存储库克隆(或提取或添加为子模块)到 / packages 文件夹,核心软件包目前存在于主 meteor / meteor 存储库的子目录中,这使得克隆它们变得更加棘手。

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.

覆盖核心软件包可能需要您手动将更改作为Meteor或软件包更新(因为Meteor过去依赖于特定的软件包版本)。

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.

如果要将更改贡献给项目,这非常有用。您应该分叉存储库并克隆自己的fork。

This is useful if you want to contribute your changes to the project. You should probably fork the repository and clone your own fork.


  1. 克隆流星存储库:

  1. Clone the meteor repository:


git clone https://github.com/meteor/meteor.git

git clone git@github.com:< username> /meteor.git 如果你分叉它


ln -s ../../(...)/meteor/packages/



你可以结账分支/提交并将它们复制到本地 packages 目录,当然。

You can checkout the desired branch/commit and copy them to the local packages directory instead, of course.



< h2>静态下载软件包目录

有一个巧妙的技巧,允许你使用 svn

这是通过以下方式获得的:

This is obtained by issuing:


svn export https://github.com/meteor/meteor/[trunk|branches/]/packages/

例如:

克隆 ddp-client devel branch:

cloning ddp-client from the devel branch:


svn export https://github.com/meteor/meteor/branches/devel/packages/ddp-client

或来自分支:


svn export https://github.com/meteor/meteor/trunk/packages/ddp-client






注:


Notes:


  1. 如前所述,如果更新Meteor,则可能需要手动应用更改。

  2. 不要忘记将包添加到项目中( meteor add< package> )如果你还没有。

  3. Meteor预计会在某个时刻切换到NPM(可能在Meteor v1.5中),所以一定要使用指定的方法在这个答案中只针对流星自己的包装系统。

  1. As mentioned earlier, you may need to manually apply changes if you update Meteor.
  2. Don't forget to add the package to the project (meteor add <package>) if you haven't already.
  3. 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.

这篇关于如何覆盖项目中的流星核心包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆