fix(client): allow regex to match windows-like paths (#42720)

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
gikf
2021-07-06 08:40:53 +02:00
committed by GitHub
parent 403c41a92d
commit 59191d581f

View File

@ -17,7 +17,8 @@ exports.replaceChallengeNode = () => {
return async function replaceChallengeNode(filePath) {
// get the meta so that challengeOrder is accurate
const blockNameRe = /\d\d-[-\w]+\/([^/]+)\//;
const blockName = filePath.match(blockNameRe)[1];
const posix = path.normalize(filePath).split(path.sep).join(path.posix.sep);
const blockName = posix.match(blockNameRe)[1];
const metaPath = path.resolve(
__dirname,
`../../curriculum/challenges/_meta/${blockName}/meta.json`