Would you consider adding composer.json library support for this module? With this addition composer update would download the colorbox library and install it into the libraries folder for you.

I'll have a patch here in moments.

CommentFileSizeAuthor
#2 composer-library-support-2714631-2.patch679 bytesthebruce

Comments

thebruce created an issue. See original summary.

thebruce’s picture

StatusFileSize
new679 bytes

Here is the patch - within the context of a drupal site it will install the colorbox library into the libraries folder on a composer update using either a well curated composer.json in your root or the composer manager module.

thebruce’s picture

I will need to circle back around to provide a complete how to test script -- which I will do as soon as I can.

frjo’s picture

Status: Active » Needs review
wellme’s picture

Thanks for this patch. Using this patch composer can download colorbox library in libraries and composer in vendor folder.

  • frjo committed d0c95f3 on 8.x-1.x authored by thebruce
    Issue #2714631 by thebruce: Consider composer library support
    
frjo’s picture

Status: Needs review » Fixed

Committed, thanks for the contribution.

MaskOta’s picture

I tried installing the module with composer require:8.x-1.x-dev
but i get the following:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for drupal/colorbox 8.x-1.x-dev -> satisfiable by drupal/colorbox[dev-8.x-1.x].
- drupal/colorbox dev-8.x-1.x requires jackmoore/colorbox master -> no matching package found.

what am i doing wrong?

Thanks

MaskOta’s picture

My bad, i was missing a crucial plguin in my json file that handles this kind of situations.

bkildow’s picture

@MaskOta, I'm getting the same error. What did you do to resolve?

MaskOta’s picture

Sorry, i was wrong. The plugin didn't matter actually. I still strugle with composer.

After a day of reading about this issue the only solution i was able to find is to copy the repository code to the root composer.json file.

"repositories": [
		    {
		      "type": "package",
		      "package": {
		        "name": "jackmoore/colorbox",
		        "version": "master",
		        "type": "drupal-library",
		        "dist": {
		          "url": "https://github.com/jackmoore/colorbox/archive/master.zip",
		          "type": "zip"
		        }
		      }
		    }
		  ],

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hussainweb’s picture

That's right. Composer only reads repositories from the root JSON file. This means that you may require the library you add but it won't work until the package is added in the main composer.json file. It is a useful thing which could be documented in README perhaps but if this is now in composer.json, I would suggest that it should be removed. It gives a wrong impression that it works without the root JSON file changes.

heddn’s picture

#2814045: composer.json issue in latest dev and 1.2.0 is opened to fix things that this seems to have broken.