Coder Social home page Coder Social logo

Comments (7)

birgire avatar birgire commented on May 18, 2024

Hi @wujekbogdan

Where is wp-content/plugins created in your case?

I wonder if it's because I've "type":"wordpress-plugin" in the composer.json ?

from geo-query.

wujekbogdan avatar wujekbogdan commented on May 18, 2024

Where is wp-content/plugins created in your case?

wp-content/plugins is created in the same directory where composer install command is executed.

├─── composer.json
├─── vendor
└─── wp-content
    └─── plugins
        └─── geo-query

I wonder if it's because I've "type":"wordpress-plugin" in the composer.json?

You are probably right, this is a composer/installers feature. Here's an article on this topic.

from geo-query.

birgire avatar birgire commented on May 18, 2024

Thanks for the links.

I already require composer/installers, so maybe you could change the installer-paths, in the extra section, in your main composer.json file? Something like:

{
    "extra": {
        "installer-paths": {
            "your/custom/path/{$name}/": ["birgir/geo-query"]
        }
    }
}

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

from geo-query.

wujekbogdan avatar wujekbogdan commented on May 18, 2024

I already require composer/installers

Yes, I know. But maybe you shouldn't use it? What's the benefit of using it? It looks like the installer causes that "issue".

Thanks for the installer-path tip. I'll use it as a workaround. But IMO it would be better if no additional effort was needed in order to install birgir/geo_query as a composer dependency.

from geo-query.

birgire avatar birgire commented on May 18, 2024

I have now added birgir/geo-query as a package on packagist.com:

https://packagist.org/packages/birgir/geo-query

I just created a test plugin, that uses birgir/geo-query as a dependency.

The test plugin has the following composer.json file:

{
  "name": "birgir/test-plugin",
  "require": {
    "birgir/geo-query": "~0.0.5"
  },
  "extra": {
        "installer-paths": {
            "vendor/{$name}/": ["birgir/geo-query"]
        }
    }
}

This seems to work as expected and generates:

composer.json
composer.lock
vendor/
   autoload.php
   composer/
   birgir/
       geo-query/

instead of

composer.json
composer.lock
vendor/
   autoload.php
   composer/
wp-content/
    plugins/
        geo-query/

If I would not use the "wordpress-plugin" type and the composer/installers, what options would we have to install it to wp-content/plugins from a main site composer.json?

Maybe I should try and look for a WordPress plugin that is used both as a vendor library and a plugin, to see how it's usually done. (don't remember such a plugin at the moment)

ps: I'm just trying to understand the limitations and avoid "burning" any bridges ;-)

from geo-query.

wujekbogdan avatar wujekbogdan commented on May 18, 2024

Thank you very much. I'll add an extra entry to my composer.json file for now. It's a workaround, but I can live with that :)

If I would not use the "wordpress-plugin" type and the composer/installers, what options would we have to install it to wp-content/plugins from a main site composer.json?

Sadly I have no idea and I'm afraid I can't help you. I'm just a Composer user. I never made a composer public package.

You can try to have a look at Timber (a great tool by the way), they have a composer-compatible version and a WordPress plugin too.

from geo-query.

birgire avatar birgire commented on May 18, 2024

great, thanks @wujekbogdan I've heard about Timber but not used it.

I will checkout Timber and try to learn how they do it.

I will mark this thread as resolved in the meanwhile ;-)

Thanks for the heads up, I learned from it ;-)

from geo-query.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.