Kirby Komments-Installation via zip

I was about to get crazy because my Kirby Komment plugin wasn't working when installed via zip file. The solution? One line…

Sometimes I don't trust my own mind. My Kirby Plugin "Komments" is working smoothly on my site. I installed it using composer. Everything was fine.

But then I got an e-mail. Somebody installed my plugin and comments couldn't be saved. Even worse: even pages couldn't be saved!

The error message: A file within one of the dependencies wasn't found. I saw the relative path in the error message and thought that might cause the error. It wasn't.

I have a local install of the Kirby Starterkit to test things beside unit tests and to reproduce errors like this one. So I copied the local dev version of my plugin over to the starterkit and everything worked.

I updated the files on github. I downloaded the zip file. Installed it. It didn't work.

I played around with the composer setup and the autoloads. But nothing seems to work. So something must be happening during the creation of that zip file.

So I opened the terminal and ran a diff on my developer version and the zip file version:

diff -rq kirby/komments kirby-test/starterkit-master/site/plugins/komments

And there it was:

Only in kirby/komments/vendor/indieweb/mention-client: src

The mentionclient used for sending webmentions has its php files located in the its own src folder. That folder existed locally in my dev version and it could also be found in the github repo. I thought about that for a while and then…

I the tutorial for a Monolithic Plugin Setup there is this one file: .gitattributes. Which causes to exclude certain folders and files from being part of the final package of the plugin. You need those files for development but not for production. And there was this one line:

src export-ignore

I just used the template for the tutorial without thinking much about it. I thought this would cause that my src directory in the root of the plugin (containing all javascript files which are compiled during build) would be ignores in the package. It was. But all other src directories are ignored, too! Which is fatal because you never know if one of your dependencies uses a src directory for production! And that was the case for me.

So I could have skipped all that playing around with autoload. The solution was to remove that one line. After that all the files were included in the zip folder and everything worked. Phew…

What you could do now

If you (don't) like this post, you can comment, write about it elsewhere, or share it. If you want to read more posts like this, you can follow me via RSS or ActivityPub, or you can view similar posts.