如何添加一些额外的包与第二composer.json,没有作曲家删除我的包呢?(How to add

2019-10-29 18:31发布

我要迁移1000个网站。 它们都是基于相同的基本Drupal的码头工人形象。

  • 每个网站也有一个自定义的Git仓库使用自定义composer.json安装一些额外的模块。
  • 我们想一个简单的方法就在同一时间全部1000个网站更新的Drupal,通过编辑1个composer.json文件。
  • 我们也想给每个1000个网站的开发人员来安装自定义模块的选项。

不幸的是什么情况是,当第二图像生成,作曲家开始删除由最初的作曲家运行安装的所有模块。 我怎样才能解决这个问题?

$ cat denpal/Dockerfile.cli
FROM php:7.2-cli-drupal

COPY composer.json /app/
COPY scripts /app/scripts
RUN composer install --no-dev
COPY . /app

# Define where the Drupal Root is located
ENV WEBROOT=web

$ cat denpal-example/Dockerfile.cli

FROM testdevelopment/denpal

COPY composer.json /app/
RUN composer install --no-dev

COPY . /app

# Define where the Drupal Root is located
ENV WEBROOT=web

$ cat denpal/composer.json
{
    "type": "project",
    "license": "GPL-2.0+",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "drupal-composer/drupal-scaffold": "^2.2",
        "cweagans/composer-patches": "~1.0",
        "drupal/core": "~8.0",
        "drush/drush": "~8.0",
        "drupal/console": "~1.0",
        "drupal/config_installer": "1.x-dev",
        "drupal/redis": "^1.0",
        "drupal/poll": "1.2",
        "drupal/search_api": "^1.6",
        "drupal/search_api_solr": "^1.2",
        "drupal/varnish_purge": "^1.10",
        "drupal/purge": "^3.0"
    },
    "require-dev": {
        "behat/mink": "~1.7",
        "behat/mink-goutte-driver": "~1.2",
        "jcalderonzumba/gastonjs": "~1.0.2",
        "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
        "mikey179/vfsstream": "~1.2",
        "phpunit/phpunit": "~4.8",
        "symfony/css-selector": "~2.8"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "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": {
        "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/contrib/{$name}": ["type:drupal-drush"]
        },
        "drupal-scaffold": {
            "excludes": [
                "sites/development.services.yml",
                "sites/example.settings.local.php"
            ]
        }
    }
}

运行此作曲家运行将删除由之前的作曲家运行安装的所有软件包:

$ cat denpal-example/composer.json
{
    "type": "project",
    "license": "GPL-2.0+",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "drutiny/drutiny": "2.3.*@dev"
    }
}
文章来源: How to add a few extra packages with a second composer.json, without composer deleting all my packages?