deminy/composer-preserve-paths

Composer plugin for preserving custom paths and supporting nested packages

Installs: 13 663

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 22

Open Issues: 0

Type:composer-plugin

0.1.4 2017-02-03 00:56 UTC

This package is auto-updated.

Last update: 2022-06-13 06:18:41 UTC


README

Build Status HHVM Status Latest Stable Version Latest Unstable Version License

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