refactor: handle certs separately (#44434)

* refactor: split createChallenge into two functions

* refactor: remove certification metas

* fix: remove the metas I missed
This commit is contained in:
Oliver Eyton-Williams
2021-12-09 20:53:12 +01:00
committed by GitHub
parent 40acfa708b
commit 9ad29e03d5
19 changed files with 42 additions and 295 deletions

View File

@ -6,6 +6,7 @@ const envData = require('../../config/env.json');
const {
getChallengesForLang,
createChallenge,
createCertification,
challengesDir,
getChallengesDirForLang
} = require('../../curriculum/getChallenges');
@ -25,13 +26,11 @@ exports.replaceChallengeNode = () => {
`../../curriculum/challenges/_meta/${blockName}/meta.json`
);
delete require.cache[require.resolve(metaPath)];
const isCert = path.extname(filePath) === '.yml';
const meta = require(metaPath);
return await createChallenge(
challengesDir,
filePath,
curriculumLocale,
meta
);
return isCert
? await createCertification(challengesDir, filePath, curriculumLocale)
: await createChallenge(challengesDir, filePath, curriculumLocale, meta);
};
};