Fix building documentation on Windows #8364
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suggested merge commit message (convention)
Fix: Fixed building documentation on Windows. Closes #7212.
Additional information
This PR is the 1 of 2 PRs that are needed to fix building documentation on Windows - the second one is https://github.com/cksource/umberto/pull/884.
TL;DR
It works on Linux and on Windows now! 🎉
Details
The main problem was with mixed
/
and\
, which were used in HTML links and paths on filesystem. After some investigation it turned out, that:path
module, because they always produce paths with native separator,path
module (e.g.path.posix.<methodName>
), because of their unreliability and inconsistency.A lot of parts of code implicitly expect that the one and only valid path separator is
/
, so I've introducedpath
module replacement - theupath
module - which unifies all paths to the same format, always! This solution works on Windows, because Windows accepts either own\
, or/
as path separator. One exception to this rule is thatwebpack
also accepts both separators and automatically fixes inconsistencies, but only for theentry
option. All other configuration options require native path separators. 😒If you previously have built docs on Linux and now you want to check it on Windows, then...
fs.readdirSync()
(used internally by theglob
module) is not able to handlebuild/docs/ckeditor5/latest
link created previously on Linux. To continue, simply remove this link manually (or the wholebuild
folder).node-sass
binary for Windows. Instead of re-installing all dependencies, it is sufficient to just runnpm rebuild node-sass
and then just startyarn docs
again.To avoid such annoyances, simply choose one OS and stick to it, always.