使用本地包 [英] Using local packages

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

问题描述

我在本地目录中有一个Elm包(源代码和所有构建工件),我想从另一个Elm包中使用它,而无需发布该库。所以我的目录设置如下所示:

I have an Elm package (source + all build artifacts) in a local directory, and I would like to use it from another Elm package, without publishing the library. So my directory setup looks like this:

/
  my-lib/
    elm-package.json
  my-app/
    elm-package.json

首先,在库软件包目录中运行 elm-package install 似乎不仅仅做编译软件包而已。据我所知,它没有安装在任何全局目录中。

First of all, running elm-package install in the library package's directory doesn't seem to do anything more than just building the package; it doesn't get installed in any global directory as far as I can tell.

我添加了 my-lib 改为 my-app / elm-package.json

"dependencies": {
    "elm-lang/core": "1.0.0 <= v < 2.0.0",
    "my-vendor/my-lib": "0.0.1 <= v <= 0.0.1"
}

所以当我在依赖包的目录中运行 elm-make ,它会抱怨

So when I run elm-make in the dependent package's directory, it complains


计算机上软件包 my-vendor / my-lib 的版本。

elm-package install 抱怨相同的事情。

我发现的唯一解决方法是创建以下内容 my-app 中的符号链接:

The only workaround I've found is to create the following symlinks in my-app:

/
  my-app/
    elm-stuff/
      packages/
        my-vendor/
          my-lib/
            0.0.1@ -> /my-lib/
      build-artifacts/
        my-vendor@ -> /my-lib/build-artifacts/my-vendor

我还必须在 /my-app/elm-stuff/exact-dependencies.json

"my-vendor/elm-lib": "0.0.1"

很明显,如果我只能将其指向 / my-lib /,则上述所有操作均应由 elm-package 自动处理 来自 / my-app / 。那么我该怎么做呢?

Clearly, all of the above should be taken care of automatically by elm-package, if only I could point it at /my-lib/ from /my-app/. So how do I do that?

推荐答案

在待办事项列表上可以更轻松地使用本地软件包。恐怕您当前的方法是最新技术。可以像现在一样操作,也可以复制软件包中的代码(或者复制<$ c $中的 my-lib / src 中的symlink modules文件夹/.elm文件) c> my-app / src ?)

Easier use of local packages is on the todo list. I'm afraid your current approach is the state of the art. Either do it like your doing it now or copy over the code from the package (or maybe symlink modules folders/.elm files from my-lib/src in my-app/src?)

邮件列表中有关此问题的最新主题:https://groups.google.com/d/topic/elm-discuss/i51Bor6Uers/discussion

Most recent thread on the mailing list about this issue: https://groups.google.com/d/topic/elm-discuss/i51Bor6Uers/discussion

这篇关于使用本地包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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