I've created a contrib theme project page https://www.drupal.org/project/thisisme and pushed code to git.drupal.org and created releases.
But I can't get the module using composer require, e.g.
composer require drupal/thisisme
Gives:
./composer.json has been updated
Running composer update drupal/thisisme
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires drupal/thisisme, it could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
I've also tried releases suffixes e.g.
composer require drupal/thisisme:1.0.x-dev
My minimum stablity is set to dev
in composer.json
I've created a contrib module in the recent past and that has worked fine with composer require
-ing it: https://www.drupal.org/project/smart_date_time_tbc/ and I am able to use that with composer require drupal/smart_date_time_tbc:1.0.x-dev
.
Therefore, just having an identified development version seems to be enough to be able to use it in composer - which is evidenced here: https://www.drupal.org/project/smart_date_time_tbc/releases/1.0.x-dev and screenshot below:
As an aside - my confusion about version numbering in different places (is this related to my problem)?
As an aside, I am a bit confused by why the versioning is in three places and with the possibility of differing version numbers, i.e.:
in the
thisisme.info.yml
file we could have:version: 1.0
(or maybe even, anything we like?!)
In git.drupal.org, the branch is
1.0.x
And on the project page a created release is
1.0.x-dev
, not1.0.x
- named after the branch name.
How does composer package manager "connect" to git.drupal.org such that composer require can fetch a drupal project, what does composer need to see?
Related research:
composer show -a drupal/thisisme
, which will show available versions. If the package isn’t found, composer.json is missing the Drupal repository configuration or there is some other problem.composer require drupal/smart_date_time_tbc:1.0.x-dev
. Therefore, just having an identified development version seems to be enough to be able to use it in composer. I'll also update section about this in the question - I had outlined this but didn't detail the actual module involved. But I will look at [Creating a project release ](drupal.org/docs/develop/git/git-for-drupal-project-maintainers/…) to see if I've missed a step.composer show -a drupal/thisisme
I get:Authentication required (packages.drupal.org):
- I'm unsure what user/password combination to give - one for drupal.org? Have you every tried this yourself for your projects, or indeed my example? What credentials did you give when asked the above?