* Read and parse a single YAML file * @param {string} filePath - Path to YAML file * @returns {object} Parsed YAML object
(filePath)
| 13 | * @returns {object} Parsed YAML object |
| 14 | */ |
| 15 | function readYamlFile(filePath) { |
| 16 | try { |
| 17 | const content = fs.readFileSync(filePath, 'utf8'); |
| 18 | return yaml.load(content, { filename: filePath }); |
| 19 | } catch (e) { |
| 20 | throw new Error(`Failed to parse ${filePath}: ${e.message}`); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Read all YAML files from a directory |