-
Notifications
You must be signed in to change notification settings - Fork 590
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
chore: update automation process for docusaurus documentation generation #1340
Conversation
@@ -29,36 +31,130 @@ process.argv.forEach(function (val, index) { | |||
console.log('Invalid argument used. To perform a dry-run use --dry-run'); |
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.
I didn't catch this last time, but, if we have error messages to show the user if we use strong formatters we can also use color and show those in red.
if (!fs.existsSync(destReadmePath)) { | ||
msg += " ...ADD readme.md into the '" + title + "' folder"; | ||
} else { | ||
msg += " ...REPLACE readme.md in the '" + title + "' folder"; |
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.
I would prefer backticks to be used instead of concat +, that would make this something like:
` ...REPLACE readme.md in the '${title}' folder`
srcFiles.forEach((srcReadmePath) => { | ||
createDestReadme(srcReadmePath); | ||
const srcDirPath = path.dirname(srcReadmePath); | ||
sidebarEntries.push("en/packages/" + srcDirPath.split(path.sep).pop() + "/index"); |
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.
I would also prefer backticks here
.toLowerCase() | ||
.split(' ') | ||
.map((s) => s.charAt(0).toUpperCase() + s.substring(1)) | ||
.join(' '); |
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.
seems like there's a little bit of inconsistency with the indenting on methods that are added on a newline, can all of these be indented the usual 4 spaces extra so:
var title = srcDirPath
.split(path.sep)
.pop()
// etc.
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.
Yah something felt off about this when I was looking at it, I'll change it to that style for sure.
"id: index\n" + | ||
"title: FAST " + title + '\n' + | ||
"sidebar_label: " + title + '\n' + | ||
"---\n\n"; |
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.
same request on the indenting here
cc73cbd
to
5f8dadf
Compare
5f8dadf
to
4aac5f5
Compare
4aac5f5
to
40b9f8e
Compare
Code Climate has analyzed commit 40b9f8e and detected 1 issue on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 85.4% (0.0% change). View more on Code Climate. |
Thanks @jkmdev! |
@nicholasrice No problem! Thanks for the review/feedback! |
Description
This PR adds a script that automates the copying of documentation files into
docs/en/packages
, a folder that stores packagereadme
pages to be used by Docusaurus. For this script there is a new npm command in the main project's package.json,docs:build
.Also included is this script is a function that handles the execution of
copy-package-readme.js
's dry-run. For the dry run there is a new npm command in the main project's package.json,docs:dry-run
.To test changes:
npm run docs:dry-run
. The output here should give an overview of what this command will do.npm run docs:build
. If successful this command will:readme.md
files indocs/en/packages
Packages
array inwebsite/sidebars.json
website/i18n/en.json
npm start
. The guide in docusaurus should list links to each package's readme file. Clicking a link will display the relevant readme.Motivation & context
The readme file for each package needs to be available to docusaurus and this script will make it possible without having to manually copy & paste files every time a readme change is made.
Implements points 3, 4 and 5 in #1312.
Issue type checklist
Is this a breaking change?
npm build
is run from thewebsites
folderProcess & policy checklist