作曲家在自定义路径中安装包或模块?
composer to install a package or module in a custom path?
我尝试在特定路径中使用 composer 安装 Drupal 模块,
我查看了这些链接,但我无法理解。
请检查这个并告诉我哪里出了问题以及我应该怎么做?
我想要什么?
Install the Signature field module in the modules/patched
directory.
这是与此问题相关的 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 install
和 composer update
,但是模块没有转移到我想要的文件夹
也许这会有所帮助(注意 extra
):
{
"extra": {
"installer-paths": {
"modules/patched/{$name}": ["drupal/signature_field"],
"modules/patched/{$name}": ["another/package"]
}
}
}
可能,这行得通:
{
"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"]
}
}
}
此外,
You cannot use this to change the path of any package. This is only
applicable to packages that require composer/installers and use a
custom type that it handles.
您还可以通过 type
:
group 您的包裹
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["type:wordpress-plugin"]
}
}
}
或某些vendor
:
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["vendor:drupal"]
}
}
}
在那里我们应该定义自定义路径并定义应该在该路径中安装哪个模块或包。
像这样
"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": {
"composer/installers": "^1.0.24",
"drupal/auto_entitylabel": "2.x-dev",
"drupal/signature_field": "^1.0@RC",
"drupal/eck": "^1.0@alpha",
}
我尝试在特定路径中使用 composer 安装 Drupal 模块,
我查看了这些链接,但我无法理解。
请检查这个并告诉我哪里出了问题以及我应该怎么做?
我想要什么?
Install the Signature field module in the
modules/patched
directory.
这是与此问题相关的 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 install
和 composer update
,但是模块没有转移到我想要的文件夹
也许这会有所帮助(注意 extra
):
{
"extra": {
"installer-paths": {
"modules/patched/{$name}": ["drupal/signature_field"],
"modules/patched/{$name}": ["another/package"]
}
}
}
可能,这行得通:
{
"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"]
}
}
}
此外,
You cannot use this to change the path of any package. This is only applicable to packages that require composer/installers and use a custom type that it handles.
您还可以通过 type
:
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["type:wordpress-plugin"]
}
}
}
或某些vendor
:
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["vendor:drupal"]
}
}
}
在那里我们应该定义自定义路径并定义应该在该路径中安装哪个模块或包。
像这样
"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": {
"composer/installers": "^1.0.24",
"drupal/auto_entitylabel": "2.x-dev",
"drupal/signature_field": "^1.0@RC",
"drupal/eck": "^1.0@alpha",
}