Meteor:可以在编写本地包时引用本地包吗? [英] Meteor: Possible to reference a local package while writing a local package?

查看:64
本文介绍了Meteor:可以在编写本地包时引用本地包吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在编写的本地包.我想从一些核心流星包中扩展一些功能.为了做到这一点,我正在创建另一个本地包.

I have a local package that I am writing. I wanted to extend some functionality from a few of the core meteor packages. In order to do this, I was creating another local package.

所以现在本地包 A 正在尝试使用本地包 B.但即使在将符号链接添加到包 A 的包文件夹后,我在运行测试包时也会收到 unknown package 错误.

So now local package A is attempting to use local package B. But even after adding the symlink to package A's packages folder, I get an unknown package error when running test-packages.

<代码>流星添加本地包-b

不起作用,因为meteor 抱怨:您不在Meteor 项目目录中

Doesn't work because meteor complains: You're not in a Meteor project directory

这是可能的还是我需要先发布到大气中?我想将附加包保留在本地,因为它将是一些辅助方法.

Is this even possible or do I need to publish to atmosphere first? I wanted to keep the additional package local as it's going to be a handful of helper methods.

我已经仔细检查了包 B 的 package.js 文件中的名称,它与包 A 的 package.js 文件中的 api.use 匹配.

I've double checked the name in package B's package.js file and it matches with my api.use in package A's package.js file.

推荐答案

此处不需要符号链接.通过检查找到本地包:

Symlinks shouldn't be necessary here. Local packages are found by checking:

  1. 环境变量 PACKAGE_DIRS 指向的目录下的任何内容.
  2. 当前应用程序目录中 packages 目录下的任何内容.
  3. 核心包.
  1. Anything under the directory pointed to by the environment variable PACKAGE_DIRS.
  2. Anything under the packages directory in the current application directory.
  3. Core packages.

只要您的两个包位于这三个位置之一,就应该可以找到.另请参阅我关于本地包的文章,了解有关 (1) 的更多详细信息.

As long as your two packages reside in one of those three locations, the should be found. Also see my article on local packaes for more details on (1).

根据我们下面的对话,主要问题与创建新包的方法有关.在编写它时,有必要将一个包添加到(或由其测试)应用程序.以下是我在处理共享的本地包时采取的步骤:

Based on our conversation below, the main issue had to do with the approach to creating a new package. While it's being written, it's necessary that a package be added to (or tested by) an app. Here are the steps I take when working on a shared, local package:

  1. 创建一个新应用.
  2. meteor create --package mypackage
  3. meteor 添加我的包
  4. 完成包的编写和测试.
  5. mypackage 移到我的 PACKAGE_DIRS 目录下,以便其他应用程序可以使用它.
  1. Create a new app.
  2. meteor create --package mypackage
  3. meteor add mypackage
  4. Finish writing and testing the package.
  5. Move mypackage under my PACKAGE_DIRS directory so it will be available to other apps.

这篇关于Meteor:可以在编写本地包时引用本地包吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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