Skip to content

Latest commit

 

History

History
114 lines (96 loc) · 3.98 KB

README.md

File metadata and controls

114 lines (96 loc) · 3.98 KB

Composer Preserve Paths

Build Status Coverage Status Latest Stable Version Total Downloads License

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 or composer update
  • Place packages within the directory of another package (using a composer installer like composer/installers)

Installation

Simply install the plugin with composer:

$ composer require drustack/composer-preserve-paths:~1.0

Configuration

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"
        ]
    }
}

Example

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"
    }
}

License

Author Information