有没有办法自行托管 DUB 注册表?

Is there a way to self-host a DUB registry?

我正在为一个客户构建多个项目,他们往往具有我已分解到单独项目中的通用代码。我正在尝试使用 DUB 来组织所有这些,但到目前为止我无法弄清楚如何将这些常见项目添加为依赖项而不将它们发布在 github 之类的网站上并在 DUB 的 public 注册表。发布这些东西要么违反我的合同,要么将无趣的垃圾邮件放入 DUB 注册表(或两者)。有什么方法可以让我在私人服务器上操作我自己的 DUB 注册表,并让它绘制所有常用 public 项目以及 LAN 可访问 git 回购中的一些私人项目?

这将使我不必制作大量 git 子模块。 :)

谢谢。

您可以在 dub-registry and providing your own --registry parameter on dub 上使用自己的 --hostname 参数自行托管配音注册表。

或者,您可以只在本地使用您的包(或者远程,如果包放在网络驱动器上)。 Dub wiki 页面 "Cookbook" 解释了如何使用不在注册表中的包:https://github.com/dlang/dub/wiki/Cookbook#working-with-submodules-or-packages-that-are-not-in-the-registry

Working with submodules or packages that are not in the registry

It is a common practice to either have a project as a git submodule of a master project, or to use an unregistered project as a dependency for development. In this setup, setting the project to depend on a project at a given path, rather than looking up the repository, can come handy. Here's an example of such a package:

{ "name": "dlang-org", "dependencies": { "libddoc": { "path": "./libddoc" }, "libdparse": { "path": "./libdparse" } } }

Another possibility is to add-local a package. This is particular useful during development, when you want to test a package with some libraries using that package.

dub add-local myrepo dub list