-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Don't throw if a doc hasn't been versioned yet #455
Conversation
Instead of throwing, return `null` because that means we have a new doc in our versioning sequence (Also, cleaned up a bit of code as I researched this) Fixes facebook#450
@@ -96,8 +96,7 @@ files.forEach(file => { | |||
metadata.original_id = metadata.id; | |||
metadata.id = 'version-' + version + '-' + metadata.id; | |||
|
|||
const targetFile = | |||
CWD + '/versioned_docs/version-' + version + '/' + path.basename(file); | |||
const targetFile = versionFolder + '/' + path.basename(file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
versionFolder
is defined above as:
const versionFolder = CWD + '/versioned_docs/version-' + version;
So might as well not repeat the same full path again.
This fix enables the Here's the output: Whatever process generates |
@iRoachie and I discussed this on our Discord channel. It looks like the
So we are bugging out parsing these somehow. We are looking to see what is going on. |
Video showing the creation process and the resulting bug. https://www.useloom.com/share/5bcc2a1575694d76b034af9ad1b2d116 |
I have a fix for the other raised issue here. I am going to send that in another PR. I am going to land this PR to make any revert easier, if needed. |
Right now we were assuming that there would be no `-` in a version. That was breaking things. This allows more flexibility for versions like: 1.0.0-beta.2 Ref facebook#455 Fixes facebook#450
Instead of throwing, return
null
because that means we have anew doc in our versioning sequence
(Also, cleaned up a bit of code as I researched this)
Fixes #450
Motivation
We had a showstopping bug where versioning would not work if you tried to add a new file to the documentation set.
Test Plan
Versioned a set of docs as 1.0.0
Added a new doc to the master set
Ran
The new doc was part of version 2.0.0
Related PRs
N/A