作曲家在自定义路径中安装软件包或模块?

时间:2019-04-18 08:18:47

标签: php module drupal-8

我尝试在特定路径下使用作曲家安装Drupal模块

我检查了这些链接,但我不知道。

请检查一下,并告诉我什么地方错了,我该怎么办?

我想要什么?

  

将签名字段模块安装在modules/patched目录中。

这是我与此问题相关的composer.json文件的一部分。

"require": {
    "composer/installers": "^1.0.24",
    "drupal/signature_field": "^1.0@RC",
},

    "installer-paths": {
        "core": ["type:drupal-core"],
        "modules/contrib/{$name}": ["type:drupal-module"],
        "profiles/contrib/{$name}": ["type:drupal-profile"],
        "themes/contrib/{$name}": ["type:drupal-theme"],
        "drush/contrib/{$name}": ["type:drupal-drush"],
        "modules/custom/{$name}": ["type:drupal-custom-module"],
        "themes/custom/{$name}": ["type:drupal-custom-theme"],
        "modules/patched/{$name}": ["type:drupal-patched-module"]
    },
    "patches": {
        "drupal/signature_field": {
            "Drupal Signature Field fix multi feilds": "modules/patched/signature_field/signature_field-2993223-08.patch"     
        }
    }
},

最后,我执行composer installcomposer update,但是模块没有转移到我想要的文件夹中

2 个答案:

答案 0 :(得分:1)

也许这会有所帮助(请注意extra):

{
    "extra": {
        "installer-paths": {
            "modules/patched/{$name}": ["drupal/signature_field"],
            "modules/patched/{$name}": ["another/package"]
        }
    }
}

ReferenceGitHub comment

可能会起作用:

{
    "extra": {
        "installer-paths": {
            "modules/patched/{$name}": ["drupal/signature_field"]
        }
    },
    "extra": {
        "installer-paths": {
            "modules/patched/{$name}": ["drupal/another_module"]
        }
    }
}

{
    "extra": {
        "installer-paths": {
            "modules/patched/{$name}": ["drupal/signature_field"]
        },
        "installer-paths": {
            "modules/patched/{$name}": ["drupal/another_module"]
        }
    }
}

  

您不能使用它来更改任何软件包的路径。这只是   适用于需要作曲者/安装者并使用   它处理的自定义类型。

您还可以通过type group打包您的包裹:

{
    "extra": {
        "installer-paths": {
            "your/custom/path/{$name}/": ["type:wordpress-plugin"]
        }
    }
}

或某些vendor

{
    "extra": {
        "installer-paths": {
            "your/custom/path/{$name}/": ["vendor:drupal"]
        }
    }
}

答案 1 :(得分:1)

我们应该定义自定义路径,并定义应该在该路径中安装哪个模块或软件包。

像这样

"installer-paths": {

    // custom path with the list of items that should installed there.

    "modules/patched/{$name}": [
        "drupal/signature_field",
        "drupal/eck",
        "drupal/auto_entitylabel"
    ],
}

该软件包或模块也应位于您的require部分。

"require": {
        "composer/installers": "^1.0.24",
        "drupal/auto_entitylabel": "2.x-dev",
        "drupal/signature_field": "^1.0@RC",
        "drupal/eck": "^1.0@alpha",
}