dreamproduction/drupal-env

Provides environment-based files mapping.

Installs: 18

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:composer-plugin

dev-master 2019-06-12 09:35 UTC

This package is auto-updated.

Last update: 2024-05-12 20:38:54 UTC


README

Provides environment-based files mapping.

How to use

1. Install the package

$ composer require dreamproduction/drupal-env

2. Add/Change composer extra

First we define a new entry under the extra key of the root composer.json file named drupal-env then add a new entry for each file that needs to be replaced. For example:

composer.json

"extra": {
   ...
   "drupal-env": {
      ".htaccess": {
         "dev": ".htaccess.dev",
         "stage": ".htaccess.stage",
         "master": ".htaccess.master",
         ...
         "<branch_name>: "<source_file>",
       }
    }
    ....
 }
 ....

When bundling with composer-boilerplate project you have to modify the /vendor/dreamproduction/composer-boilerplate/composer.settings.json file as such:

vendor/dreamproduction/composer-boilerplate/composer.settings.json

"scripts": {
    ...
    "post-install-cmd": [
       "@composer run-script drupal-scaffold",
       "@composer run-script drupal-env"
    ],
    ...
    "drupal-env": [
        "DreamProduction\\Composer\\DrupalEnv::postUpdate"
    ],
    ...

3. Create a GIT branch-based file

You need to create a git branch-based file mapping which will replace the target file as defined in the extra area of your composer.json root file and commit it under GIT.