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}`;
|
||||
|
||||
const pagesDir = path.resolve(__dirname, guideDir);
|
||||
const indexMdRe = new RegExp(`\\${path.sep}index.md$`);
|
||||
|
||||
function withGuidePrefix(str) {
|
||||
return `/guide${str}`;
|
||||
@ -26,10 +27,9 @@ exports.createNavigationNode = function createNavigationNode(node) {
|
||||
parent
|
||||
} = node;
|
||||
|
||||
const nodeDir = fileAbsolutePath.replace(/\/index\.md$/, '');
|
||||
const dashedName = nodeDir.split('/').slice(-1)[0];
|
||||
const [, nodePath] = nodeDir.split(pagesDir);
|
||||
|
||||
const nodeDir = path.resolve(fileAbsolutePath).replace(indexMdRe, '');
|
||||
const dashedName = nodeDir.split(path.sep).slice(-1)[0];
|
||||
const nodePath = nodeDir.split(pagesDir)[1].split(path.sep).join('/');
|
||||
const parentPath = nodePath
|
||||
.split('/')
|
||||
.slice(0, -1)
|
||||
|
@ -47,6 +47,7 @@ async function buildCurriculum(file, curriculum) {
|
||||
challengeBlock = curriculum[superBlock].blocks[block];
|
||||
} catch (e) {
|
||||
console.log(superBlock, block);
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(0);
|
||||
}
|
||||
const { meta } = challengeBlock;
|
||||
@ -64,7 +65,7 @@ async function buildCurriculum(file, curriculum) {
|
||||
}
|
||||
|
||||
function superBlockInfoFromPath(filePath) {
|
||||
const [maybeSuper] = filePath.split('/');
|
||||
const [maybeSuper] = filePath.split(path.sep);
|
||||
return superBlockInfo(maybeSuper);
|
||||
}
|
||||
|
||||
@ -82,6 +83,6 @@ function superBlockInfo(fileName) {
|
||||
}
|
||||
|
||||
function getBlockNameFromPath(filePath) {
|
||||
const [, block] = filePath.split('/');
|
||||
const [, block] = filePath.split(path.sep);
|
||||
return block;
|
||||
}
|
||||
|
Reference in New Issue
Block a user