0
0

初步给项目、飞行器、容器页面添加了git拉取功能

This commit is contained in:
xubing
2025-12-05 20:17:05 +08:00
parent a7edfb82c5
commit 2c314b9b0b
19 changed files with 2557 additions and 156 deletions

View File

@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GitService = void 0;
// src/panels/services/GitService.ts
const fs = __importStar(require("fs"));
const isomorphic_git_1 = __importDefault(require("isomorphic-git"));
const node_1 = __importDefault(require("isomorphic-git/http/node"));
@@ -255,16 +256,25 @@ class GitService {
}
/**
* 构建文件树
* 这里显式忽略:
* - .git 目录
* - .dcsp-data.json
* - 其它以 . 开头的隐藏文件/目录
*/
static async buildFileTree(dir, relativePath = '') {
try {
const files = await fs.promises.readdir(dir);
const tree = [];
for (const file of files) {
if (file.startsWith('.') && file !== '.git')
// 1. 不要解析 .git
if (file === '.git')
continue;
// 2. 不要解析项目数据文件
if (file === '.dcsp-data.json')
continue;
// 3. 其它所有隐藏文件/目录统统忽略
if (file.startsWith('.'))
continue;
const filePath = path.join(dir, file);
const stats = await fs.promises.stat(filePath);
const currentRelativePath = path.join(relativePath, file);