Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

composer.json install-path for custom module hosted externally? #170

Closed
justinlevi opened this issue Jun 16, 2016 · 2 comments
Closed

composer.json install-path for custom module hosted externally? #170

justinlevi opened this issue Jun 16, 2016 · 2 comments

Comments

@justinlevi
Copy link
Contributor

How can we specify another installer-path for custom modules, that reside in an external private repository, so that the module will get installed in a custom directory?

  "extra": {
    "installer-paths": {
      "docroot/core":                     ["type:drupal-core"],
      "docroot/modules/contrib/{$name}":  ["type:drupal-module"],
      "docroot/profiles/contrib/{$name}": ["type:drupal-profile"],
      "docroot/themes/contrib/{$name}":   ["type:drupal-theme"],
      "drush/contrib/{$name}":            ["type:drupal-drush"]
    },

Something like this would be helpful I think:
"docroot/modules/custom/{$name}": ["type:drupal-custom-modules"],

Update:
Doing some googling I found that you can do the following:

{
    "extra": {
        "installer-paths": {
            "sites/example.com/modules/{$name}": ["vendor/package"]
        }
    }
}

Haven't had a chance to try this yet but looks promising.I'd be happy to add something to one of the readme files. Any ideas where info like this should go?

source: https://getcomposer.org/doc/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md

@grasmash
Copy link
Contributor

The listed package types drupal-core,drupal-module, etc are all registered in https://github.com/composer/installers. This is what allows them to be mapped to specific installation paths.

I think that the example snippet you listed would actually map all packages to "sites/example.com/modules/{$name}" which would cause a lot of problems.

If you'd like to specify an install location for a custom module, you may be able to use https://github.com/mnsami/composer-custom-directory-installer. I haven't tried it myself, but I believe that you can create a composer.json in your custom module, define the type as composer, and then use this library to map the specific package to a specific directory.

@justinlevi
Copy link
Contributor Author

Sorry, I didn't mean to use that path directly in my example I was thinking more of something like this:

"docroot/modules/custom/{$name}": [ "drupal/MY_CUSTOM_MODULE"],

thanks for the tip, I'll check that out.

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

No branches or pull requests

2 participants