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

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

问题描述

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

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

Git Repository 与两个项目之类的

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 add package 时,你需要了解 Meteor 如何处理包扫描:

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

  • 在您的应用的本地 packages/ 文件夹中搜索它.
  • PACKAGE_DIRS 环境变量中指定的每个文件夹中搜索它.
  • 正在 Atmosphere 上搜索.
  • 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/ 下的应用根文件夹中,你只需要从 repo 中 git pull 来获取最新版本的软件包.然后,您必须确保正确定义 PACKAGE_DIRS 环境变量,如下所示:

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 存储库中,然后将它们拉入您的本地 $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

如果这些私有包有可能被其他项目重用,我倾向于采用第二种方案,如果你确定它们只在特定项目中有意义,那么将它们一起存储在 repo 中是可以的.

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天全站免登陆