hyperaudio / wordpress-hyperaudio

a wordpress plugin to display interactive transcripts
GNU General Public License v2.0
11 stars 8 forks source link

Composer access #151

Closed irondan closed 2 days ago

irondan commented 2 months ago

I've got a site where I'm trying to install the plugin via composer (based on Roots Bedrock). Generally this is pretty straightforward to do from a GitHub repository, which is lovely because that gives me version control on the basis of tagged releases. But in this case there are obstacles, and there seem to be enough that I cannot get around them.

  1. Usually you can find WordPress plugins listed in the plugin directory listed as packages on WPackagist. That's the most straightforward way and how I get most plugins. The effort to get this plugin listed on the WordPress Plugin Directory https://github.com/hyperaudio/wordpress-hyperaudio/issues/76 hasn't seen any followup since November 1st, 2023. While this might see some progress, I cannot count on it at present. Bummer.

  2. No problem, Composer has by default methods of retrieving packages from VCS, and GitHub specifically. All I have to do is create a definition for the package in the repositories section of my composer.json. Something like:

      "hyperaudio": {
        "type": "package",
        "package": {
          "name": "hyperaudio/wordpress-hyperaudio",
          "version": "1.0.23",
          "type": "wordpress-plugin",
          "source": {
            "url": "https://github.com/hyperaudio/wordpress-hyperaudio",
            "type": "git",
            "reference": "v1.0.23"
          }
        }
      }

Except it doesn't work in this case because the actual plugin is nested inside of the repo's main directory (with a largely duplicated README to boot!). So when composer installs that, WP can't see the plugin in the subdirectory. Bummer.

  1. No problem! I think. Composer also can let you use ZIP files as packages, and helpfully the outer README provides a "pre-zipped" version meant for direct installation (though that seems detached from the repo, so I'm not sure how confident I can be about persistent access. Oh well, what can you do?). So I set it up like this in packages:
    "hyperaudio": {
      "type": "package",
      "package": {
        "name": "hyperaudio/wp-hyperaudio",
        "version": "1.0.23",
        "type": "wordpress-plugin",
        "dist": {
          "url": "https://lab.hyperaud.io/wordpress-plugin/v1.0.23/wp-hyperaudio-1.0.23.zip",
          "type": "zip"
        }
      }
    }

Except it doesn't work this time either. Apparently this ZIP file was created on a Mac OSX machine. When composer moves to unzip it instead of condensing into a wp-hyperaudio directory it remains nested, so that the __MACOSX metadata folder can be extracted alongside the contents. Bummer.

I've tried to engage with this plugin using composer in most all the ways I know how. Any one of these issues could be resolved and make this functional. Any chance of any of them being resolved?

maboa commented 3 weeks ago

Hi @irondan Sorry for the slow reply. I'm not sure why the plugin has not been added to the wp directory, I have received no word from them since I submitted. If the zipped version doesn't work for you, can you create your own zip file with the same contents?

irondan commented 3 weeks ago

Hello @maboa , thank you for taking a look!

Right now my workaround is to copy the plugin files and put them in place on the site repo, then force commit them into the site's git repo with some .gitignore lines like

web/app/plugins/*
!web/app/plugins/wp-hyperaudio

Totally functional, but obviously not ideal keeping someone else's code in the site repo as if it were a custom plugin.

Ultimately what I'd like to see is maybe a couple changes to this repo to improve it's usability:

If you'd like @maboa you can assign this issue to me and I can prepare a Pull Request that tries to clean some of this up. Let me know if you'd be interested in that.

maboa commented 3 weeks ago

It all sounds sensible to me and sounds like you know a lot more about this than me @irondan, so feel free to create a PR for this – thank you!! Just a heads up that I'm currently making a couple of modifications to the plugin addressing #152 and #153. They should be complete this week.