初步给项目、飞行器、容器页面添加了git拉取功能
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user