Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Add composer support #26

Open
wants to merge 2 commits into
base: 8.x-1.x
Choose a base branch
from
Open

Add composer support #26

wants to merge 2 commits into from

Conversation

killua99
Copy link

@killua99 killua99 commented Mar 2, 2016

Composer is a must in drupal 8 development, so I thought should be good include the library needed for this module into a compoer so could be easy handle with installation paths.

@Berdir
Copy link

Berdir commented Mar 2, 2016

Where does composer put this? Unless it puts it into the libraries folder, I don't think that actually helps?

@killua99
Copy link
Author

killua99 commented Mar 2, 2016

This put inside vendor folder but we use composer in this way mostly.

{
    "name": "killua99/drupal-project-tweaks",
    "description": "Tweaked Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0+",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.drupal-composer.org"
        }
    ],
    "require": {
        "composer/installers": "^1.0.20",
        "cweagans/composer-patches": "~1.0",
        "drupal/core": "8.1.*-dev",
        "drush/drush": "~8.0",
        "drupal/console": "~0.10",
        "drupal/paragraphs": "^8.1@RC",
        "drupal/file_browser": "8.1.x-dev",
        "desandro/imagesloaded": "dev-master",
        "desandro/masonry": "dev-master",
        "mnsami/composer-custom-directory-installer": "^1.1",
        "enyo/dropzone": "^4.3"
    },
    "require-dev": {
        "behat/mink": "~1.6",
        "behat/mink-goutte-driver": "~1.2",
        "jcalderonzumba/gastonjs": "^1.1@dev",
        "jcalderonzumba/mink-phantomjs-driver": "dev-master#10d7c48c9a4129463052321b52450d98983c4332",
        "mikey179/vfsStream": "~1.2",
        "phpunit/phpunit": "~4.8",
        "symfony/css-selector": "2.7.*"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-install-cmd": "sh ./scripts/composer/post-install.sh"
    },
    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "web/libraries/imagesloaded": ["desandro/imagesloaded"],
            "web/libraries/masonry": ["desandro/masonry"],
            "web/libraries/dropzone": ["enyo/dropzone"]
        }
    }
}

Installations path is a must in composer project because the drupal contrib module are target with the type:drupal-module so you could keep running composer update instead drush commands.

So it will be useful for project management. And since in in packegist because make sense to be in composer. Is not the only JavaScript library that is in packagist already.

@Berdir
Copy link

Berdir commented Mar 2, 2016

Sure, the module itself is fine. and drupal packagist would add the minimal automatically anyway. I meant the dropzonejs library that you're adding as dependency.

Edit: Ah, now I see. Ignore above. Yeah, that's not perfect that you have to do it for all, but it's not so bad either, actually. Thanks for showing that.

@Berdir
Copy link

Berdir commented Mar 2, 2016

We should possibly document that somewhere then, maybe in the README?

@killua99
Copy link
Author

killua99 commented Mar 2, 2016

We should add it on the README about the path install.

But the composer is needed for automatic and for simplytest.me support.''

edit: And is not about perfection, because for contrib modules like this one you have to define the installation path, other wise it goes to vendor folder.

But composer project should be right setup and if this module provide the required library that this module need inside it, will be really helpful

@Berdir
Copy link

Berdir commented Mar 2, 2016

Yes, sorry if I wasn't clear. That's exactly what I meant. Document in the readme how to set up the project composer.json so that the library is added to the right folder. I suppose it's not possible to put that into composer.json (so that composer would merge it in automatically).

@killua99
Copy link
Author

killua99 commented Mar 2, 2016

You're right, childs composer like this one doesn't support the path installation, that need to be done in the root composer file. So it will a great idea to mention it on the README file tho.

],
"support": {
"issues": "https://www.drupal.org/project/issues/dropzonejs",
"irc": "irc://irc.freenode.org/drupal-contribute",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drupal-media is the channel that we normally "advertise" for support :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@thebruce
Copy link

Would you consider the following as an alternative? This will work with the webflow composer manager style workflow and it will also place the code into the defined libraries folder.

{
  "name": "drupal/dropzonejs",
  "type": "drupal-module",
  "description": "Drupal integration for DropzoneJS - an open source library that provides drag’n’drop file uploads with image previews.",
  "homepage": "https://www.drupal.org/project/dropzonejs",
  "license": "GPL-2.0+",
  "keywords": ["php", "entity", "drupal", "files", "ui", "browser"],
  "homepage": "https://www.drupal.org/project/dropzonejs",
  "minimum-stability": "dev",
  "authors": [
    {
      "name": "Primoz Hmeljak",
      "homepage": "https://www.drupal.org/u/primsi",
      "role": "Maintainer"
    },
    {
      "name": "Janez Urevc",
      "homepage": "https://www.drupal.org/u/slashrsm",
      "role": "Maintainer"
    }
  ],
  "support": {
    "issues": "https://www.drupal.org/project/issues/dropzonejs",
    "irc": "irc://irc.freenode.org/drupal-media",
    "source": "http://git.drupal.org/project/dropzonejs.git"
  },
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "enyo/dropzone",
        "version": "master",
        "type": "drupal-library",
        "dist": {
          "url": "https://github.com/enyo/dropzone/archive/master.zip",
          "type": "zip"
        },
        "require": {
          "composer/installers": "~1.0"
        }
      }
    }
  ],
  "require": {
    "enyo/dropzone": "^4.3"
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants