fix: rebuild challenge pages if source is updated (#62056)

This commit is contained in:
Oliver Eyton-Williams
2025-09-05 15:22:38 +02:00
committed by GitHub
parent 49c64a14b3
commit e257c2969e
5 changed files with 107 additions and 13 deletions
@@ -39,13 +39,15 @@ exports.sourceNodes = function sourceChallengesSourceNodes(
watcher.on('change', filePath =>
/\.md?$/.test(filePath)
? onSourceChange(filePath)
.then(challenge => {
.then(challenges => {
reporter.info(
`
File changed at ${filePath}, replacing challengeNode id ${challenge.id}
File changed at ${filePath}, replacing challengeNodes with ids ${challenges.map(({ id }) => id).join(', ')}
`
);
createVisibleChallenge(challenge, { isReloading: true });
challenges.forEach(challenge =>
createVisibleChallenge(challenge, { isReloading: true })
);
})
.catch(e =>
reporter.error(`fcc-replace-challenge
@@ -74,13 +76,15 @@ File changed at ${filePath}, replacing challengeNode id ${challenge.id}
const { path: siblingPath } = entry;
const relativePath = path.join(blockPath, siblingPath);
onSourceChange(relativePath)
.then(challenge => {
.then(challenges => {
reporter.info(
`
File changed at ${relativePath}, replacing challengeNode id ${challenge.id}
File changed at ${relativePath}, replacing challengeNodes with ids ${challenges.map(({ id }) => id).join(', ')}
`
);
createVisibleChallenge(challenge);
challenges.forEach(challenge =>
createVisibleChallenge(challenge)
);
})
.catch(e =>
reporter.error(`fcc-replace-challenge