forwards-long-jump / discotron

Modular Discord bot supporting plugins hosted on git repositories
MIT License
3 stars 5 forks source link

Should we replace nodegit by another module? #66

Open Blatoy opened 4 years ago

Blatoy commented 4 years ago

I think we should find another module because of the 2 following reasons:

            Git.Repository.open(__dirname + "/../repositories/" + this._folderName)
                .then((repository) => {
                    repo = repository;
                    return repository.fetch("origin");
                })
                .then(() => {
                    return repo.mergeBranches("master", "origin/master");
                })
                .then((oid) => {
                    resolve();
                }).catch((err) => {
                    reject();
                });

We decided to use this module in the first place because it does not rely on having git installed on the machine.

RedMser commented 4 years ago

I don't see a reason why you would want Git as a required project dependency. What if users want to use a different VCS? What if they want to make a local plugin without using a remote git repo?

Additionally, Git is made to be used via command line (you shouldn't need an API for Git), so I don't see why we don't just spawn child processes and read stdout.

Blatoy commented 4 years ago

While nodegit is a pain, I still think it would be great if we could avoid having to run processes manually and parse result strings, maybe there is a module that does that? The idea behind using git there is to allow plugin developers to easily share and update their plugin. Adding other VCS sounds like a very very low priority. Loading plugins from the folder even if they are not using git sounds like a good idea though.

RedMser commented 4 years ago

Yeah, out of scope for this issue / this early into the project.

Regarding Git: we could try simple-git. It has a CLI wrapper for common tasks (including pull and clone), while also providing a raw mode (where we can just run any Git command, such as for tracking how many commits behind we are). It also supports authentication, for private repositories.