Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: fix docs publish on windows #5005

Merged
merged 1 commit into from
Feb 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions scripts/publish/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ function execute(command) {
}

function readFiles(directory, filelist) {
if(directory[directory.length - 1] != '/') {
directory = directory.concat('/');
if(directory[directory.length - 1] != `${path.sep}`) {
directory = directory.concat(`${path.sep}`);
}

const files = fs.readdirSync(directory);
filelist = filelist || [];
files.forEach((file) => {
if (fs.statSync(directory + file).isDirectory()) {
filelist = readFiles(directory + file + '/', filelist);
filelist = readFiles(directory + file + `${path.sep}`, filelist);
} else {
const originalPath = directory + file;
const newPath = path.join(outputPath, originalPath
.replace(documentationPath + '/', '')
.replace('/', '-'));
.replace(documentationPath + `${path.sep}`, '')
.replace(`${path.sep}`, '-'));

filelist.push({ originalPath, newPath });
}
Expand Down Expand Up @@ -81,8 +81,11 @@ function createFiles() {

function checkNameLinks(files) {
return files.reduce((pValue, cValue) => {
const oldName = cValue.originalPath.split('/').slice(-1).pop().replace('.md', '');
const newName = '(' + cValue.newPath.split('/').slice(-1).pop().replace('.md', '') + ')';
const oldName = cValue.originalPath
.replace(documentationPath + `${path.sep}`, '')
.replace('.md', '')
.replace(`${path.sep}`, '/')
const newName = '(' + cValue.newPath.split(`${path.sep}`).slice(-1).pop().replace('.md', '') + ')';
if (oldName !== newName) {
pValue.push({
oldName,
Expand Down