Should this perhaps be added to pull selectize/selectize from github via composer?
I'm not sure about Drupal best-practice here.

    {
      "type": "package",
      "package": {
        "name": "selectize/selectize",
        "version": "dev-master",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/selectize/selectize.js/archive/master.zip",
          "type": "zip"
        }
      }
    }
CommentFileSizeAuthor
#3 selectize.bower-asset.2949060.patch777 bytessun

Comments

Anybody created an issue. See original summary.

anybody’s picture

PS: A composer library / packagist.org library from selectize itself doesn't seem to exist yet. See https://github.com/selectize/selectize.js/issues/1378 for a feature request.

sun’s picture

Status: Active » Needs review
StatusFileSize
new777 bytes

Followed up on https://github.com/selectize/selectize.js/issues/1378

There is https://asset-packagist.org/package/bower-asset/selectize that can be used instead.

Somehow my local composer.json doesn't look like https://cgit.drupalcode.org/selectize/tree/composer.json?h=8.x-1.x – let's see whether this patch applies.

rodrigoaguilera’s picture

I think adding repositories to the composer.json won't help solve this issue since the composer.json for this module will never be a root composer.json except when you are developing the module itself.

Maybe the maintainer for this module can submit a package to packagist.org with the type: 'drupal-library' so installing this module requires less manual steps.

There is a shim package here https://packagist.org/packages/grimmlink/selectize
but is outdated and doesn't have any type.

sun’s picture

I think it would be at least an improvement compared to status quo, because most projects probably have the asset-packagist repository anyway already. Therefore, the new requirement would be picked up and installed correctly.

Right now, the requirement cannot be resolved at all, because the repositories definition in the composer.json of drupal/selectize does not bubble up to the root project (by design). I only changed the repositories definition, so that a composer install remains to work within the module folder.

anybody’s picture

Yes this is a problem of many contrib modules which require external libraries... perhaps a core issue or discussion exists for that?

rodrigoaguilera’s picture

For clarification the current situation (HEAD and beta5) is composer.json without dependencies.
https://cgit.drupalcode.org/selectize/tree/composer.json?h=8.x-1.x

I really don't know what repo is the latest patch made against.

So folks without the proper repo will get a non-reachable dependency.

Apart from redoing the patch against the latest HEAD I feel the question is: Do we assume most of the people will have the asset-packagist repo configured?

For reference: I'm trying to make it a standard here
https://github.com/drupal-composer/drupal-project/pull/286

mlncn’s picture

A very similar version of this (pegged to 0.12.6 rather than latest, which is probably a good idea and i think no difference right now anyway) is included in the RTBC patch at #2678916: Add support for entity reference with autocomplete

pasqualle’s picture

Status: Needs review » Needs work

The composer.json changes should go into readme or install.txt file as repositories do not work from module composer.json.

https://www.drupal.org/docs/creating-custom-modules/add-a-composerjson-f...
https://www.drupal.org/docs/develop/documenting-your-project/module-docu...

#3198417: Official support for npm

mlncn’s picture

It still doesn't *hurt* to add:

  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "selectize/selectize",
        "version": "0.12.6",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/selectize/selectize.js/archive/v0.12.6.zip",
          "type": "zip"
        }
      }
    }
  ],

and

  "require": {
    "selectize/selectize": "^0.12.6"
   }

in composer.json.

I recommend we do that and then document the Composer merge plugin like Webform does.