如何在多个项目之间共享私人流星包? [英] How to share private meteor packages between multiple projects?

查看:90
本文介绍了如何在多个项目之间共享私人流星包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果要在两个项目之间使用程序包,最好的处理方法是什么.考虑两种情况:-

If you want to use a package between two projects, what's the best way to handle it. Considering two scenarios :-

Git存储库,其中有两个项目,例如

Git Repository with the two projects like

root folder
    -- Mobile App Folder
    -- Web Folder

所以两个项目都在同一个存储库中

So both projets are in the same repository

每个项目都位于单独的Git存储库中,我们希望在这些项目之间共享软件包.

Each project is in separate Git repositories and we want to share the package between those projects.

什么是处理每种情况的好方法? (或者对两种情况使用相同的方法,或者对每种情况使用不同的方法)

What's a good ways to handle each scenario? ( Either using the same method for both, or different methods for each scenario)

推荐答案

您需要了解Meteor在遇到meteor add package时如何处理包扫描:

You need to be aware of how Meteor handles package scanning when confronted with meteor add package :

  • 在应用程序的本地packages/文件夹中搜索它.
  • PACKAGE_DIRS环境变量中指定的每个文件夹中搜索它.
  • 在大气中搜索它.
  • searching for it inside the local packages/ folder of your app.
  • searching for it inside every folder specified in the PACKAGE_DIRS environment variable.
  • searching for it on Atmosphere.

不确定具体顺序,但我认为最有意义的顺序.

Not sure about the specific order but I'm assuming the one that makes most sense.

因此,您的问题基本上是在哪里存储软件包以实现最佳工作流程.

So your question is basically where to store the package for an optimal workflow.

使用拳头方案,您可以将私有软件包存储在packages/下的应用程序根文件夹中,只需从存储库中git pull即可获取软件包的最新版本.然后,您必须确保正确定义了PACKAGE_DIRS env变量,如下所示:

Using the fist scenario, you would store your private packages inside the app root folder under packages/, you'll just have to git pull from the repo to get the latest versions of the packages. Then you would have to make sure to define correctly the PACKAGE_DIRS env variable, something like this :

export PACKAGE_DIRS=$PACKAGE_DIRS:$HOME/meteor/my-repo/packages

在第二种情况下,您将每个私有软件包存储在其自己的git仓库中,然后将其放入您本地的git $HOME/meteor/packages中,并且不要忘记适当地设置PACKAGE_DIRS.

Using the second scenario, you would store each private package on its own git repo, then pull them into a local $HOME/meteor/packages of yours and don't forget to set PACKAGE_DIRS appropriately.

export PACKAGE_DIRS=$PACKAGE_DIRS:$HOME/meteor/packages

如果有可能将这些私有软件包重用于其他项目,我会倾向于第二种情况,如果您确定它们仅在特定项目中有意义,那么将它们存储在仓库中就可以了.

I would tend to go with the second scenario if there's a chance that these private packages may be reused for other projects, if you are sure they only make sense in a particular project, then storing them along in the repo is OK.

这篇关于如何在多个项目之间共享私人流星包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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