| 525 | } |
| 526 | |
| 527 | function findInLearningTracks(href) { |
| 528 | const allFiles = walk(path.join(DATA_ROOT, 'learning-tracks'), { |
| 529 | globs: ['*.yml'], |
| 530 | includeBasePath: true, |
| 531 | directories: false, |
| 532 | }) |
| 533 | const found = [] |
| 534 | for (const filePath of allFiles) { |
| 535 | const tracks = yaml.load(fs.readFileSync(filePath, 'utf-8')) |
| 536 | |
| 537 | if ( |
| 538 | Object.values(tracks).find((track) => { |
| 539 | const guides = track.guides || [] |
| 540 | return guides.includes(href) |
| 541 | }) |
| 542 | ) { |
| 543 | found.push(filePath) |
| 544 | } |
| 545 | } |
| 546 | return found |
| 547 | } |
| 548 | |
| 549 | function changeLearningTracks(filePath, oldHref, newHref) { |
| 550 | // Can't deserialize and serialize the Yaml because it would lose |