Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Working on a Drupal module using composer

Parent Feed: 

So I needed the latest git checkout of the source code from external entities Drupal module. Its latest is 8.x-2.x

Using composer require drupal/external_entities is not enough as that will download the latest released version in this case 8.x-2.0-alpha1

Using composer require drupal/external_entities:8.x-2.x is not a valid version for composer as Drupal versions are not semantic versioned.

We should use as version 2.x which is a Drupal 8 compatible branch . SemVer can work with dev versions using 2.x-dev so using composer require drupal/external_entities:2.x-dev we get the latest dev. But still as zip

By altering composer.json setting a preferred-install for the module we finally get the latest git checkout.

"config": {
    "preferred-install": {
        "drupal/external_entities": "source",
        "*": "dist"
    },
    "autoloader-suffix": "Drupal8"
}

After running composer require drupal/external_entities:2.x-dev we get a git checkout but it is a detached head.

cd modules/contrib/external_entities
git status
HEAD detached at 809e275
nothing to commit, working tree clean

The final step is to do git checkout origin and you can create patches.

Refs

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web