it-swarm.com.de

Wie kann ich ein auf GitHub gehostetes Modul über composer.json herunterladen?

Ich habe die folgende composer.json Datei:

{
    "name": "my-project",
    "type": "project",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "contrib/term-csv-tree-import",
                "version": "dev-master",
                "type":"drupal-module",
                "source": {
                    "url": "https://github.com/grahl/term_csv_tree_import.git",
                    "type": "git",
                    "reference": "master"
                }
            }
        }
    ],
}

Nach composer update Wird das Modul jedoch wie folgt in den Ordner vendor heruntergeladen:

./vendor/contrib/term-csv-tree-import/term_csv_tree_import.info.yml
./vendor/contrib/term-csv-tree-import/term_csv_tree_import.module
./vendor/contrib/term-csv-tree-import/term_csv_tree_import.routing.yml

Wie kann ich die obige Konfiguration korrigieren, um das Projekt als Drupal Modul unter docroot/modules/contrib Ordner herunterzuladen? Mein Drupal root befindet sich unter docroot Mappe.

3
kenorb

Dazu benötigen Sie Composer Installers :

{
    "name": "my-project",
    "type": "project",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "contrib/term-csv-tree-import",
                "version": "dev-master",
                "type":"drupal-module",
                "source": {
                    "url": "https://github.com/grahl/term_csv_tree_import.git",
                    "type": "git",
                    "reference": "master"
                }
            }
        }
    ],
    "require": {
        "composer/installers": "^1.2"
    },   
    "extra": {
        "installer-paths": {
            "docroot/libraries/{$name}": ["type:drupal-library"],
            "docroot/modules/contrib/{$name}": ["type:drupal-module"],
            "docroot/profiles/contrib/{$name}": ["type:drupal-profile"],
            "docroot/themes/contrib/{$name}": ["type:drupal-theme"]
        }
    }
}
6
Clive