XF 2.3 Multi Addon Github setup

QuackieMackie

Active member
I’ve started housing my addon repositories separately on GitHub and now I’ve run into a problem.

When I switch branches from addon/A → addon/B, the files for addon/A get removed, which breaks certain parts of my site because those files are still needed.

Ideally, I want both sets of files to remain accessible, even when switching branches between different addons.
But I still want to be able to switch between addon branches and have them swap files like they're doing now (e.g., addon/A-branch1 → addon/A-branch2).

How do you all handle your projects?
 
Addons should all be in the src/addons/<vendor>/<addon_id> directory.

For example, my KnownBots addon is in src/addons/Hampel/KnownBots

This is relative to my dev XenForo install path.

Each <addon_id> directory is its own git repo.
 
I have no idea what's going on in your video.

Having different addons in different branches is simply not going to work - XenForo does not expect addon code to appear and disappear randomly if you check out different branches. Your code and your database will get completely out of sync.

XenForo addons are a collection of php+json files that is your code and addon definition files (addon.json, build.json, etc) PLUS, a bunch of json+txt+html files in the _output directory, which is a representation of the configuration of your addon from your database, plus the templates and phrases etc. Keeping these json, html and txt files in sync between your filesystem/git repo and the database is critical for the operation of your plugin. Arbitrarily removing them by checking out a branch where these files don't exist is going to really confuse XenForo.

That wouldn't sadly work with what I'd want.

Why not? What is it you are trying to achieve with your setup?
 
XenForo addons are a collection of php+json files that is your code and addon definition files (addon.json, build.json, etc) PLUS, a bunch of json+txt+html files in the _output directory, which is a representation of the configuration of your addon from your database, plus the templates and phrases etc. Keeping these json, html and txt files in sync between your filesystem/git repo and the database is critical for the operation of your plugin. Arbitrarily removing them by checking out a branch where these files don't exist is going to really confuse XenForo.
Ah I wasn't aware that changing the _output like that would cause issues. I had assumed I could just work on a couple of branches of each addon without problem. If I have a few ways of doing something, I tend to just create a new branch to try it multiple ways as it's sometimes easier than replicating the enviroment I'm trying something on.

Why not? What is it you are trying to achieve with your setup?
I don't always work at the same device and having all my repos easily cloneable was my goal.
Like with https://github.com/Sylphian-Network/Sylphian-Map I am able to clone that onto a new device without any messing around.
 
I don't always work at the same device and having all my repos easily cloneable was my goal.
Like with https://github.com/Sylphian-Network/Sylphian-Map I am able to clone that onto a new device without any messing around.

Well yes, that's kind of the point of hosted git like github and bitbucket - you can have multiple people working on the same codebase and/or you working on it from multiple devices. That's irrelevant to how you should structure your code though.

One repo per addon will still allow you to work on your code from different devices.
 
Well yes, that's kind of the point of hosted git like github and bitbucket - you can have multiple people working on the same codebase and/or you working on it from multiple devices. That's irrelevant to how you should structure your code though.

One repo per addon will still allow you to work on your code from different devices.
Yes, but that would mean anyone wanting to use the repo would have to manually create the vendor folder. That kind of defeats the point in my eyes, the user shouldn’t have to set up anything extra just to clone it.

Your suggestion works for me and anyone who already has that environment, but for new contributors it would still require additional setup.

I'm aiming for a setup that allows both, me to work from multiple devices without problem, and for other people to be able to contribute to it if they desire. The best solution so far is probably just to change the vendor name.
 
Yes, but that would mean anyone wanting to use the repo would have to manually create the vendor folder. That kind of defeats the point in my eyes, the user shouldn’t have to set up anything extra just to clone it.

Your suggestion works for me and anyone who already has that environment, but for new contributors it would still require additional setup.

Well yes - they need to install the addon. Create the folder and clone the repo into it, then install it from the CLI. That's how you do it.

I do it all the time - I've just set up a new dev server and am transferring addons from my old dev server. I push the latest version of each repo to github, then clone it to the correct folder on the new server. Then I install the addon from the CLI and it's ready to use and develop further. Then when I'm ready to work on the next addon, I do the same process.

Your way, people can only ever work on one addon at a time because you can't have multiple git repos in the same folder.

So if I've got my own addons and I want to work on your addon, I have to set up a completely new dev server just to work on yours because of the way you have it structured. If you did it one repo per addon, then I could simply clone yours to my src/addons folder and work on it alongside all of my other addons in my existing dev server.
 
Not sure how experienced you are with Git but it'll be a good plus to get familiar with that first and how what you were doing with the above wasn't the right path.

Mainly due to not really needing to make the folder manually at all if one uses git clone cloneurlsshhttphere ./{vendor_id}/

That will create the folder in your current working dir and then clone the repo into that folder.
 
Not sure how experienced you are with Git but it'll be a good plus to get familiar with that first and how what you were doing with the above wasn't the right path.

Mainly due to not really needing to make the folder manually at all if one uses git clone cloneurlsshhttphere ./{vendor_id}/

That will create the folder in your current working dir and then clone the repo into that folder.
I know the basics and thats it. I'm forcing myself to use it more but It's slow going :laugh:
It confuses the heck out of me.

Thank you for letting me know, thats very handy.
 
Back
Top Bottom