优化多个Composer VCS存储库路径 [英] Optimize multiple Composer VCS repository paths

查看:122
本文介绍了优化多个Composer VCS存储库路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些composer.json文件,其中包含如下部分:

I've got some composer.json files that contain sections like this:

"repositories": [
    {
        "type": "vcs",
        "url": "http://svn.example.com/libs/",
        "package-path": "Package1"
    },
    {
        "type": "vcs",
        "url": "http://svn.example.com/libs/",
        "package-path": "Package2"
    },
    {
        "type": "vcs",
        "url": "http://svn.example.com/libs/",
        "package-path": "Package3"
    }
],

"require": {
    "ident/Package1": "~2.0",
    "ident/Package2": "~3.0",
    "ident/Package3": "~1.0"
}

也就是说,各个软件包位于Subversion中../trunk目录下的子目录中,而不是它们自己的标准./目录下的项目。 [trunk,tags,branches]布置。

That is, the individual packages are in subdirectories beneath the ../trunk directory in Subversion, instead of their own project directories with the standard ./[trunk,tags,branches] arrangement.

是否可以优化此composer.json以免o仅当 package-path type url 的值$ c>有变化吗?假设我无法更改Subversion目录的布局,但几乎可以进行其他任何操作。

Is there a way to optimize this composer.json so as not to have to repeat the VCS type and url values when only the package-path changes? Assume that I cannot change the Subversion directory layout, but just about anything else would be possible.

推荐答案

我想不出办法

优化的真正潜力处于完全不同的水平:您添加私有存储库的方式要求您始终将每个存储库都添加到根目录中 composer.json 文件,即使软件包没有直接包含在其中。

The real potential for optimization is on a completely different level: The way you are adding private repositories requires you to always add every one of them to the root composer.json file even if the packages are not directly included there.

这是很多维护工作。最好是例如使用 Satis 创建本地软件包存储库,并且仅在各处添加此单个信息。使用Satis,您将只添加一次您的私有存储库-然后,是否重复一个URL并不重要。添加新软件包仅在Satis配置中完成一次,然后随处可用。

This is a lot of maintenance work. It would be better if you can for example use Satis to create a local package repository and only add this single info everywhere. Using Satis, you will then only add your private repositories once - and then it doesn't really matter whether or not you repeat a URL. Adding new packages will only be done once in the Satis configuration, and then be available everywhere.

这篇关于优化多个Composer VCS存储库路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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