mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Check if git repo root in plugin update
This commit is contained in:
@@ -8,7 +8,7 @@ import path from 'node:path';
|
|||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import { default as git } from 'simple-git';
|
import { default as git, CheckRepoActions } from 'simple-git';
|
||||||
import { color } from './src/util.js';
|
import { color } from './src/util.js';
|
||||||
|
|
||||||
const __dirname = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = import.meta.dirname ?? path.dirname(fileURLToPath(import.meta.url));
|
||||||
@@ -49,7 +49,7 @@ async function updatePlugins() {
|
|||||||
const pluginPath = path.join(pluginsPath, directory);
|
const pluginPath = path.join(pluginsPath, directory);
|
||||||
const pluginRepo = git(pluginPath);
|
const pluginRepo = git(pluginPath);
|
||||||
|
|
||||||
const isRepo = await pluginRepo.checkIsRepo();
|
const isRepo = await pluginRepo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
|
||||||
if (!isRepo) {
|
if (!isRepo) {
|
||||||
console.log(`Directory ${color.yellow(directory)} is not a Git repository`);
|
console.log(`Directory ${color.yellow(directory)} is not a Git repository`);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|||||||
import url from 'node:url';
|
import url from 'node:url';
|
||||||
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { default as git } from 'simple-git';
|
import { default as git, CheckRepoActions } from 'simple-git';
|
||||||
import { sync as commandExistsSync } from 'command-exists';
|
import { sync as commandExistsSync } from 'command-exists';
|
||||||
import { getConfigValue, color } from './util.js';
|
import { getConfigValue, color } from './util.js';
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ async function updatePlugins(pluginsPath) {
|
|||||||
const pluginPath = path.join(pluginsPath, directory);
|
const pluginPath = path.join(pluginsPath, directory);
|
||||||
const pluginRepo = git(pluginPath);
|
const pluginRepo = git(pluginPath);
|
||||||
|
|
||||||
const isRepo = await pluginRepo.checkIsRepo();
|
const isRepo = await pluginRepo.checkIsRepo(CheckRepoActions.IS_REPO_ROOT);
|
||||||
if (!isRepo) {
|
if (!isRepo) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user