Packagist switch

Summary

On Wednesday, December 14th, Lightning will release 1.14 and 2.0.0. 2.0.0 will be functionally identical to 1.14 but will point to the new official D.O packagist. 1.14 will include a script to update your project to 2.0.0. After updating to 1.14 as normal, simply run the following commands to update to 2.0.0:

$ cd docroot/path/to/lightning/profile #usually docroot/profiles/contrib/lightning
$ composer run upgrade-build 

More information

In addition to the main PHP Packagist, Drupal uses its own packagist for Drupal-specific packages (e.g. modules and themes). Historically, Lightning has used the packagist at https://packagist.drupal-composer.org for this purpose.

Around DrupalCon New Orleans, the Drupal Association announced that it was creating an official Drupal.org packagist. It has been up for several months now, so Lightning will switch to the official Drupal.org packagist on December 14, 2016.

This transition poses a few challenges. Specifically:

We get around the first challenge by submitting Lightning to the main PHP Packagist -- which properly processes its dependencies -- and instructing our scaffold project to look for it there.

For the second challenge, Lightning 1.14 will include a script that can automatically change your project's Composer dependencies' version constraints to the new formatnote1. It will also update your composer.json file so that Composer will fetch Lightning from the main PHP Packagist, and all other Drupal dependencies from the official Drupal.org packagist.

For more information on the challenges and our solutions, see Lightning Packagist slides.

Update instructionsnote2:

  1. From the root of your project, run composer require drupal/lightning:8.1.14 --no-update. The root of your project is usually one level up from the docroot directory.
  2. Run composer update.
  3. Change into the Lightning Profile directory (from project root, this is usually docroot/profiles/contrib/lightning).
  4. Run composer run upgrade-build.
  5. Switch back to the root of your project and run composer update.

The upgrade-build script - from Step 4 above - automates the following:

  • Changes your Drupal dependencies' version constraints to the new format.
  • Adds a reference to the official Drupal.org packagist and removes the legacy one.
  • Changes Lightning's namespace to acquia so that it will be pulled from the main packagist and have its dependencies processed properly.
  • Updates Lightning's version constraint to ~2.0.0.

If you don't want to use the update script, or if your root composer.json file uses ranges in its version constraintsnote1, you can go through the above steps manually. See the Converting your project from Drupal Packagist to the official packages.drupal.org service section on Drupal.org for more information.

note1:
The update script does not support ranges in version constraints (click here for examples). If you have any ranges in your composer.json, you will need to alter those manually before updating your dependencies.

note2:
Lightning 1.14 and 2.0.0 will not be tagged until 14 December. Do not attempt to run these update instructions until then.

Powered by Drupal Lightning