Composer plugin for preserving custom paths and supporting nested packages.
This way you can:
- Provide custom files or directories that will not be overwritten on
composer install
orcomposer update
- Place packages within the directory of another package (using a composer installer like composer/installers)
Simply install the plugin with composer:
$ composer require drustack/composer-preserve-paths:~1.0
For configuring the paths you need to set preserve-paths
within the extra
of your root composer.json
.
{
"extra": {
"preserve-paths": [
"web/sites/all/modules/contrib",
"web/sites/all/themes/contrib",
"web/sites/all/libraries",
"web/sites/all/drush",
"web/sites/default/settings.php",
"web/sites/default/files"
]
}
}
An example composer.json using composer/installers:
{
"config": {
"vendor-dir": "vendor"
},
"extra": {
"installer-paths": {
"web/": [
"type:drupal-core"
],
"web/profiles/{$name}/": [
"type:drupal-profile"
],
"web/sites/all/drush/{$name}/": [
"type:drupal-drush"
],
"web/sites/all/libraries/{$name}/": [
"type:drupal-library"
],
"web/sites/all/modules/contrib/{$name}/": [
"type:drupal-module"
],
"web/sites/all/modules/custom/{$name}/": [
"type:drupal-custom-module"
],
"web/sites/all/themes/contrib/{$name}/": [
"type:drupal-theme"
],
"web/sites/all/themes/custom/{$name}/": [
"type:drupal-custom-theme"
]
},
"preserve-paths": [
"web/sites/all/modules/contrib",
"web/sites/all/themes/contrib",
"web/sites/all/libraries",
"web/sites/all/drush",
"web/sites/default/settings.php",
"web/sites/default/files"
]
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/7"
}
],
"require": {
"composer/installers": "~1.0",
"drupal/drupal": "~7.54",
"drupal/views": "3.x-dev",
"drustack/composer-preserve-paths": "~1.0"
}
}
- Wong Hoi Sing Edison