Plugins: Add auto-update functionality (#3487)

* Plugins: Add auto-update functionality

* Check if directory is a git repo

* Display message if any plugins were loaded
This commit is contained in:
Cohee
2025-02-16 20:55:53 +02:00
committed by GitHub
parent 4d323ec76f
commit 362470da18
3 changed files with 83 additions and 2 deletions

View File

@ -48,6 +48,13 @@ async function updatePlugins() {
console.log(`Updating plugin ${color.green(directory)}...`);
const pluginPath = path.join(pluginsPath, directory);
const pluginRepo = git(pluginPath);
const isRepo = await pluginRepo.checkIsRepo();
if (!isRepo) {
console.log(`Directory ${color.yellow(directory)} is not a Git repository`);
continue;
}
await pluginRepo.fetch();
const commitHash = await pluginRepo.revparse(['HEAD']);
const trackingBranch = await pluginRepo.revparse(['--abbrev-ref', '@{u}']);