-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
New docs versioning - repo proposal #1855
Conversation
# Conflicts: # docs-v2/package.json
Codecov Report
@@ Coverage Diff @@
## new-docs #1855 +/- ##
=========================================
Coverage 22.59% 22.59%
=========================================
Files 324 324
Lines 6245 6245
Branches 804 801 -3
=========================================
Hits 1411 1411
+ Misses 4226 4224 -2
- Partials 608 610 +2
Continue to review full report at Codecov.
|
@@ -35,30 +38,33 @@ const createFile = (stat, fileName, workingDir, baseDir) => { | |||
name, | |||
title, | |||
isFile: true, | |||
route: path.join(routeBase, routeFile), | |||
route: path.posix.join(routeBase, routeFile), |
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.
Can you give some context on this?
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.
On windows all the routes were generated with the "\" instead of "/" and it breaks routing completely.
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.
This works on windows, though? Interesting.
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.
Yeah, it just enforce the path
to use posix style thingies..
@@ -0,0 +1,22 @@ | |||
function getGitClone(docsRepo, outputDir) { |
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.
Nice work on extracting out all these little tasks!
Codecov Report
@@ Coverage Diff @@
## new-docs #1855 +/- ##
=========================================
Coverage 22.59% 22.59%
=========================================
Files 324 324
Lines 6245 6245
Branches 804 797 -7
=========================================
Hits 1411 1411
- Misses 4226 4242 +16
+ Partials 608 592 -16
Continue to review full report at Codecov.
|
…at might be printed.
…better strategy than just publishing docs to the repo on every build in CI.
|
||
const versionRegex = [/^\/([0-9]+-[0-9]+-[0-9]+)\//, /^\/([0-9]+-[0-9]+-[0-9]+)$/]; | ||
|
||
function getVersionHref(path, href) { |
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.
Can you explain the rationale for this?
I'm having a hard time understanding what this exactly is doing / is for?
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.
Let's say we are browsing in https://storybook.js.org/3-2-9/help. Every link here should be related to the /3-2-9/ subdir. But the problem is that every link starts with '/' so it's actually relative to the root. In this case clicking on this link will open the wrong page (or will shot a wrong window.location
that after refresh will open a wrong page).
getVersionHref
is looking for the /x-x-x/
pattern and then returns the url that is base on this version.
After that it's attached to the as
parameter of the next\link
that will just show the right url in the window.location
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.
gotcha!
@@ -35,30 +38,33 @@ const createFile = (stat, fileName, workingDir, baseDir) => { | |||
name, | |||
title, | |||
isFile: true, | |||
route: path.join(routeBase, routeFile), | |||
route: path.posix.join(routeBase, routeFile), |
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.
This works on windows, though? Interesting.
docs-v2/lib/dirToTree.js
Outdated
})); | ||
}; | ||
|
||
const createDirectory = (items, localWorkingDir, baseDir) => ({ | ||
route: localWorkingDir.replace(baseDir, ''), | ||
route: localWorkingDir.replace(baseDir, '').replace(/\\/, '/'), |
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.
comment that this is for windows compatibility, would be nice.
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.
sure
Issue: related to #1773
What I did
I've added a functionality to the docs-v2 build script that will commit a new exported docs version to a separate repo
Tasks TBD
DOCS_REPO
variable with access token to CIversions.json
for a versions drop-down_next
dir the old app version data should be deleted.Example
https://storypuke-mlglazhotd.now.sh
https://storypuke-mlglazhotd.now.sh/3-0-0
https://storypuke-mlglazhotd.now.sh/3-0-1
https://storypuke-mlglazhotd.now.sh/3-2-5
https://storypuke-mlglazhotd.now.sh/3-2-9
How to test
Meanwhile:
package.json
- it's needed because the build script is looking for it to upgrade the version.docs-v2/package.json
change the build script to this:"build": "cross-env DOCS_REPO=https://{your_user_here}:{token_from_step_3}@github.com/{repo} node scripts/build.js",
build
script from the step 4docs-v2/package.json
build
script from the step 4 again to see that newer version committed to the repo as wellnow
configuration here: https://github.com/igor-dv/storypuke-docs/blob/master/package.json