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
+10 -3
View File
@@ -10,6 +10,7 @@ const {
getBlockCreator
} = require('../../curriculum/build-curriculum');
const { getBlockStructure } = require('../../curriculum/file-handler');
const { getSuperblocks } = require('../../curriculum/build-curriculum');
const { curriculumLocale } = envData;
@@ -17,21 +18,27 @@ exports.localeChallengesRootDir = getContentDir(curriculumLocale);
const blockCreator = getBlockCreator(curriculumLocale);
exports.replaceChallengeNode = () => {
return async function replaceChallengeNode(filePath) {
exports.replaceChallengeNodes = () => {
return async function replaceChallengeNodes(filePath) {
const parentDir = path.dirname(filePath);
const block = path.basename(parentDir);
const filename = path.basename(filePath);
console.log(`Replacing challenge node for ${filePath}`);
const meta = getBlockStructure(block);
const superblocks = getSuperblocks(block);
return await blockCreator.createChallenge({
const challenge = await blockCreator.createChallenge({
filename,
block,
meta,
isAudited: true
});
return superblocks.map(superBlock => ({
...challenge,
superBlock
}));
};
};