UNPKG

v3mt

Version:

A CLI toolkit for managing and deploying Victoria 3 mods, including sending mod files to the game, launching the game, and more.

24 lines (23 loc) 842 B
import fs from 'fs'; import path from 'path'; import Logger from '../../../utils/logger/logger.js'; export default function findMetadataFiles(dir = process.cwd()) { const metadataFiles = []; try { const files = fs.readdirSync(dir); for (const file of files) { const filePath = path.join(dir, file); const stat = fs.statSync(filePath); if (stat.isDirectory() && !file.startsWith('.') && file !== 'node_modules') { const metadataPath = path.join(filePath, '.metadata', 'metadata.json'); if (fs.existsSync(metadataPath)) { metadataFiles.push(metadataPath); } } } } catch (error) { Logger.warn(`Failed to read directory ${dir}: ${error.message}`); } return metadataFiles; }