grasmash / composerize-drupal

Convert a non-Composer-managed Drupal application (e.g., one created via tarball) to a Composer-managed Drupal application.
MIT License
125 stars 20 forks source link

Build Status Coverage Status Packagist

Composerize Drupal

Composerize Drupal is a Composer plugin that converts a non-Composer-managed Drupal application (e.g., one created via tarball) to a Composer-managed Drupal application.

It is not for creating new Drupal applications. If you want to create a brand new Drupal application, use drupal-project instead.

Functionality

The composerize-drupal command will perform the following operations:

It will NOT add any contributed projects in docroot/libraries to composer.json. You must add those to your composer.json file manually. In addition to packagist and Drupal.org packages, you may also use any package from asset packagist, which makes NPM packages available to Composer.

Installation

composer global require grasmash/composerize-drupal

Usage:

cd path/to/drupal/project/repo
composer composerize-drupal --composer-root=[repo-root] --drupal-root=[drupal-root]

The [composer-root] should be the root directory of your project, where .git is located.

The [drupal-root] should be the Drupal root, where index.php is located.

Examples:

# Drupal is located in a `docroot` subdirectory.
composer composerize-drupal --composer-root=. --drupal-root=./docroot

# Drupal is located in a `web` subdirectory.
composer composerize-drupal --composer-root=. --drupal-root=./web

# Drupal is located in a `public_html` subdirectory (cPanel compatible).
composer composerize-drupal --composer-root=. --drupal-root=./public_html

# Drupal is located in the repository root, not in a subdirectory.
composer composerize-drupal --composer-root=. --drupal-root=.

Options