fix: build on Windows (#18831)

This commit is contained in:
Valeriy
2018-10-25 12:54:57 +03:00
committed by mrugesh mohapatra
parent e1335d774b
commit bad6fc3e53
2 changed files with 7 additions and 6 deletions

View File

@ -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)