Files
ONE-OS/axhub-make/vite-plugins/utils/fileUtils.ts
王冕 a27e3b8e43 feat: sync full workspace including web modules, docs, and configurations to Gitea
Optimized the root .gitignore to exclude virtual environments, node modules,
and temp folders to ensure clean and lightweight version tracking.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 18:12:25 +08:00

18 lines
410 B
TypeScript

import fs from 'fs';
/**
* 从文件注释中读取显示名称
*/
export function getDisplayName(filePath: string): string | null {
try {
const content = fs.readFileSync(filePath, 'utf8');
const nameMatch = content.match(/@(?:name|displayName)\s+(.+)/);
if (nameMatch && nameMatch[1]) {
return nameMatch[1].trim();
}
} catch (err) {
// 忽略读取错误
}
return null;
}