Skip to content

Commit 68cd1c7

Browse files
filipesilvahansl
authored andcommitted
build: fix docs publish on windows (angular#5005)
1 parent 87b2ad8 commit 68cd1c7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

scripts/publish/docs.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ function execute(command) {
2424
}
2525

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

3131
const files = fs.readdirSync(directory);
3232
filelist = filelist || [];
3333
files.forEach((file) => {
3434
if (fs.statSync(directory + file).isDirectory()) {
35-
filelist = readFiles(directory + file + '/', filelist);
35+
filelist = readFiles(directory + file + `${path.sep}`, filelist);
3636
} else {
3737
const originalPath = directory + file;
3838
const newPath = path.join(outputPath, originalPath
39-
.replace(documentationPath + '/', '')
40-
.replace('/', '-'));
39+
.replace(documentationPath + `${path.sep}`, '')
40+
.replace(`${path.sep}`, '-'));
4141

4242
filelist.push({ originalPath, newPath });
4343
}
@@ -81,8 +81,11 @@ function createFiles() {
8181

8282
function checkNameLinks(files) {
8383
return files.reduce((pValue, cValue) => {
84-
const oldName = cValue.originalPath.split('/').slice(-1).pop().replace('.md', '');
85-
const newName = '(' + cValue.newPath.split('/').slice(-1).pop().replace('.md', '') + ')';
84+
const oldName = cValue.originalPath
85+
.replace(documentationPath + `${path.sep}`, '')
86+
.replace('.md', '')
87+
.replace(`${path.sep}`, '/')
88+
const newName = '(' + cValue.newPath.split(`${path.sep}`).slice(-1).pop().replace('.md', '') + ')';
8689
if (oldName !== newName) {
8790
pValue.push({
8891
oldName,

0 commit comments

Comments
 (0)