* Read all YAML files from a directory * @param {string} dirPath - Directory containing YAML files * @returns {Promise } Array of parsed YAML objects with _filePath metadata
(dirPath)
| 27 | * @returns {Promise<object[]>} Array of parsed YAML objects with _filePath metadata |
| 28 | */ |
| 29 | async function readYamlDir(dirPath) { |
| 30 | const pattern = path.join(dirPath, '*.yaml').replace(/\\/g, '/'); |
| 31 | const files = await glob(pattern); |
| 32 | |
| 33 | return files.map(file => ({ |
| 34 | ...readYamlFile(file), |
| 35 | _filePath: file, |
| 36 | _fileName: path.basename(file, '.yaml') |
| 37 | })); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Convert a name to a filename-safe slug |
no test coverage detected