5

After upgrading Drupal to the last version with Drush (8.1.15) the other composer.json dependencies (e.g. drupalconsole) are removed.

Are there any way to update Drupal with Drush keeping other composer dependencies?

diff --git a/docroot/composer.json b/docroot/composer.json
index 6089861..b9536cf 100644
--- a/docroot/composer.json
+++ b/docroot/composer.json
@@ -4,28 +4,11 @@
     "type": "project",
     "license": "GPL-2.0+",
     "require": {
-        "ckeditor/fakeobjects": "4.6.2",
-        "ckeditor/image": "4.6.2",
-        "ckeditor/link": "4.6.2",
-        "codemirror/codemirror": "5.27.4",
         "composer/installers": "^1.0.24",
-        "drupal/console": "~1.0",
-        "jquery/geocomplete": "1.7.0",
-        "jquery/icheck": "1.0.2 ",
-        "jquery/image-picker": "0.3.0",
-        "jquery/inputmask": "3.3.7",
-        "jquery/intl-tel-input": "12.0.0",
-        "jquery/rateit": "1.1.1",
-        "jquery/select2": "4.0.3",
-        "jquery/timepicker": "1.11.11 ",
-        "jquery/toggles": "4.0.0",
-        "jquery/word-and-character-counter": "2.5.1",
-        "progress-tracker/progress-tracker": "1.4.0",
-        "signature_pad/signature_pad": "2.3.0",
-        "wikimedia/composer-merge-plugin": "~1.4"
+        "wikimedia/composer-merge-plugin": "^1.4"
     },
     "replace": {
-        "drupal/core": "~8.3"
+        "drupal/core": "^8.4"
     },
     "minimum-stability": "dev",
     "prefer-stable": true,

I've seen that there is a composer project for Drupal but I'm not using it in this project.

  • 1
    "I've seen that there is a composer project for Drupal but I'm not using it in this project." ... then start. – user21641 Oct 13 '17 at 8:14
  • @IvanJaros How you can you start using drupal.project on an already started project? – sanzante Oct 13 '17 at 8:55
  • 1
    Just follow the instructions in here github.com/drupal-composer/drupal-project and then copy your sites directory in it. – user21641 Oct 13 '17 at 9:12
  • Probably because it overwrote the composer.json file with whats on Drupal.org. Ivan is correct, you would need to use a Composer favoring solution like Drupal Project or Acquia BLT where this would not happen. – Kevin Oct 13 '17 at 14:52
-1

If you have a composer based project, you probably should use composer to update it. E.g.:

composer update drupal/core --with-dependencies

Make sure to keep the composer.json, composer.lock, and docroot/vendor/composer/installed.json files in your repository.

Note: It's best to go 'all-in' with composer and use it to add and maintain modules as well as core. E.g.:

Add new module: composer require drupal/module

Update module: composer update drupal/module --with-dependencies

To manage patches, see the cweagans/composer-patches project.

You can also include various 3rd party libraries (e.g. chosen, colorbox, and the like) using your composer.json file.

  • 1
    I believe what the OP is asking about is a composer.json file that was overwritten during a core update, and losing all that information - not how to use Composer. – Kevin Oct 13 '17 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.