drupal-composer/preserve-paths

Composer plugin for preserving custom paths and supporting nested packages

Installs: 979 146

Dependents: 10

Suggesters: 0

Security: 0

Stars: 27

Watchers: 7

Forks: 26

Open Issues: 12

Type:composer-plugin

0.1.6 2020-11-14 20:28 UTC

This package is auto-updated.

Last update: 2024-03-15 04:15:55 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 or composer update
  • place packages within the directory of another package (using a composer installer like composer/installers or davidbarratt/custom-installer)

Installation

Simply install the plugin with composer: composer require drupal-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": [
          "web/sites/all/modules/contrib",
          "web/sites/all/themes/contrib",
          "web/sites/all/libraries",
          "web/sites/all/drush"
        ]
      }
}

Example

An example composer.json using composer/installers:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://packages.drupal.org/7"
    }
  ],
  "require": {
    "composer/installers": "^1.2",
    "drupal-composer/preserve-paths": "0.1.*",
    "drupal/views": "3.*",
    "drupal/drupal": "7.*"
  },
  "config": {
    "vendor-dir": "vendor"
  },
  "extra": {
    "installer-paths": {
      "web/": ["type:drupal-core"],
      "web/sites/all/modules/contrib/{$name}/": ["type:drupal-module"],
      "web/sites/all/themes/contrib/{$name}/": ["type:drupal-theme"],
      "web/sites/all/libraries/{$name}/": ["type:drupal-library"],
      "web/sites/all/drush/{$name}/": ["type:drupal-drush"],
      "web/profiles/{$name}/": ["type:drupal-profile"]
    },
    "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"
    ]
  }
}