deminy / composer-preserve-paths
Composer plugin for preserving custom paths and supporting nested packages
Installs: 13 702
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 26
Open Issues: 0
Type:composer-plugin
Requires
- composer-plugin-api: ^1.0
Requires (Dev)
- composer/composer: ~1.0
- derhasi/tempdirectory: 0.1.*
- phpunit/phpunit: >=4.4
This package is auto-updated.
Last update: 2023-11-13 09:26:41 UTC
README
Composer plugin for preserving paths while installing, updating or uninstalling 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 or davidbarratt/custom-installer)
This plugin was originally developed by Johannes Haseitl. I updated it to allow wildcard pattern matching when defining preserved paths, which is necessary if you have many sites installed with same Drupal installation (i.e., you have many directories like example.com, example.net, example.org, etc under folder sites/ of your Drupal installation).
Installation
Simply install the plugin with composer: composer require deminy/composer-preserve-paths
Configuration
For configuring the paths you need to set preserve-paths
within the extra
of your root composer.json
.
{ "extra": { "preserve-paths": [ "htdocs/sites/all/modules/contrib", "htdocs/sites/all/themes/contrib", "htdocs/sites/all/libraries", "htdocs/sites/all/drush", "htdocs/sites/*.com", "htdocs/sites/*.net", "htdocs/sites/*.org" ] } }
Example
An example composer.json using davidbarratt/custom-installer:
{ "repositories": [ { "type": "composer", "url": "https://packagist.drupal-composer.org/" } ], "require": { "davidbarratt/custom-installer": "dev-master", "deminy/composer-preserve-paths": "dev-master", "drupal/views": "7.*", "drupal/drupal": "7.*" }, "config": { "vendor-dir": "vendor" }, "extra": { "custom-installer": { "drupal-module": "htdocs/sites/all/modules/contrib/{$name}/", "drupal-theme": "htdocs/sites/all/themes/contrib/{$name}/", "drupal-library": "htdocs/sites/all/libraries/{$name}/", "drupal-drush": "htdocs/sites/all/drush/{$name}/", "drupal-profile": "htdocs/profiles/{$name}/", "drupal-core": "htdocs/" }, "preserve-paths": [ "htdocs/sites/all/modules/contrib", "htdocs/sites/all/themes/contrib", "htdocs/sites/all/libraries", "htdocs/sites/all/drush", "htdocs/sites/*.com", "htdocs/sites/*.net", "htdocs/sites/*.org" ] } }