mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix: rebuild challenge pages if source is updated (#62056)
This commit is contained in:
committed by
GitHub
parent
49c64a14b3
commit
e257c2969e
@@ -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
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user