it-swarm.com.de

So installieren Sie eine bestimmte Version von Drupal using Composer

Composer installiert immer die neueste Version von Drupal Core, ich möchte 8.6, nicht 8.7.

Wie kann ich das erreichen?

3
Jeff Burnz

Drupal-Projekt mit der Option --no-install erstellen:

composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --no-interaction --no-install

Ändern Sie die Verzeichnisse in my_site_name_dir und bearbeiten Sie die Versionsbeschränkungen in der Datei composer.json:

"require": {
    ...
    "drupal/core": "8.6.*",
    ...
},

Auch für

"require-dev": {
    "webflo/drupal-core-require-dev": "8.6.*"
},

webflo/drupal-core-require-dev bietet die require-dev-Abhängigkeiten von drupal/core als eigenständiges Paket. Es folgt demselben Release-Zyklus und Versionsschema wie Drupal Core. Sie sollten dieselbe Versionsbeschränkung verwenden wie für Drupal Core).

Lauf composer install

4
4k4

Mein Fehler bestand darin, nicht die richtige Webflo/Drupal-Core-Require-Dev-Version neben der Drupal/Core-Version festzulegen, daher sollte composer.json folgendermaßen aussehen:

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "php": ">=5.6",
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6.5",
        "drupal-composer/drupal-scaffold": "^2.5",
        "drupal/console": "^1.0.2",
        "drupal/core": "8.6.17",
        "drush/drush": "^9.0.0",
        "vlucas/phpdotenv": "^2.4",
        "webflo/drupal-Finder": "^1.0.0",
        "webmozart/path-util": "^2.3",
        "zaporylie/composer-drupal-optimizations": "^1.0"
    },
    "require-dev": {
        "webflo/drupal-core-require-dev": "8.6.17"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/{$name}": ["type:drupal-drush"]
        },
        "drupal-scaffold": {
            "initial": {
                ".editorconfig": "../.editorconfig",
                ".gitattributes": "../.gitattributes"
            }
        }
    }
}
0
Jeff Burnz