fix: build on Windows (#18831)
This commit is contained in:
committed by
mrugesh mohapatra
parent
e1335d774b
commit
bad6fc3e53
@ -13,6 +13,7 @@ const guideDir = `../../../${
|
|||||||
}/${locale}`;
|
}/${locale}`;
|
||||||
|
|
||||||
const pagesDir = path.resolve(__dirname, guideDir);
|
const pagesDir = path.resolve(__dirname, guideDir);
|
||||||
|
const indexMdRe = new RegExp(`\\${path.sep}index.md$`);
|
||||||
|
|
||||||
function withGuidePrefix(str) {
|
function withGuidePrefix(str) {
|
||||||
return `/guide${str}`;
|
return `/guide${str}`;
|
||||||
@ -26,10 +27,9 @@ exports.createNavigationNode = function createNavigationNode(node) {
|
|||||||
parent
|
parent
|
||||||
} = node;
|
} = node;
|
||||||
|
|
||||||
const nodeDir = fileAbsolutePath.replace(/\/index\.md$/, '');
|
const nodeDir = path.resolve(fileAbsolutePath).replace(indexMdRe, '');
|
||||||
const dashedName = nodeDir.split('/').slice(-1)[0];
|
const dashedName = nodeDir.split(path.sep).slice(-1)[0];
|
||||||
const [, nodePath] = nodeDir.split(pagesDir);
|
const nodePath = nodeDir.split(pagesDir)[1].split(path.sep).join('/');
|
||||||
|
|
||||||
const parentPath = nodePath
|
const parentPath = nodePath
|
||||||
.split('/')
|
.split('/')
|
||||||
.slice(0, -1)
|
.slice(0, -1)
|
||||||
|
@ -47,6 +47,7 @@ async function buildCurriculum(file, curriculum) {
|
|||||||
challengeBlock = curriculum[superBlock].blocks[block];
|
challengeBlock = curriculum[superBlock].blocks[block];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(superBlock, block);
|
console.log(superBlock, block);
|
||||||
|
// eslint-disable-next-line no-process-exit
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
const { meta } = challengeBlock;
|
const { meta } = challengeBlock;
|
||||||
@ -64,7 +65,7 @@ async function buildCurriculum(file, curriculum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function superBlockInfoFromPath(filePath) {
|
function superBlockInfoFromPath(filePath) {
|
||||||
const [maybeSuper] = filePath.split('/');
|
const [maybeSuper] = filePath.split(path.sep);
|
||||||
return superBlockInfo(maybeSuper);
|
return superBlockInfo(maybeSuper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +83,6 @@ function superBlockInfo(fileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getBlockNameFromPath(filePath) {
|
function getBlockNameFromPath(filePath) {
|
||||||
const [, block] = filePath.split('/');
|
const [, block] = filePath.split(path.sep);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user