-
Notifications
You must be signed in to change notification settings - Fork 43
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
refactor: split out fixtures, test cleanup #542
Conversation
... so we can reuse it for Changelog! 🚀 No functional changes were made, docs tests should still pass.
@@ -8,12 +8,12 @@ const pushDoc = require('../../lib/pushDoc'); | |||
module.exports = class SingleDocCommand { | |||
constructor() { | |||
this.command = 'docs:single'; | |||
this.usage = 'docs:single <filepath> [options]'; | |||
this.usage = 'docs:single <file> [options]'; |
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.
Doesn't <file>
need to match the arg that we're going to be using (filePath
in this case)?
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.
Nope, this is just the string used for the usage example
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.
It's been so long since I've looked at this part of the code but how does it know to give you the first arg as filePath
?
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 swear I thought it was parsing the usage string to determine if things were required or not
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 guy:
Lines 28 to 32 in aaad56d
{ | |
name: 'filePath', | |
type: String, | |
defaultOption: true, | |
}, |
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.
Ah there it is. Ignore me today!
@@ -62,7 +62,7 @@ module.exports = class SingleDocCommand { | |||
|
|||
debug(`selectedVersion: ${selectedVersion}`); | |||
|
|||
const createdDoc = await pushDoc(key, selectedVersion, dryRun, filepath); | |||
const createdDoc = await pushDoc(key, selectedVersion, dryRun, filePath, this.category); |
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.
Where's this.category
being set?
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.
We pass that into the pushDoc
function so we can use it for dynamic routing:
Line 42 in aaad56d
return fetch(`${config.get('host')}/api/v1/${type}`, { |
The idea is we can use a single handler for docs
, changelogs
, and custompages
routes
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.
OH right, this.category
is the category that it shows up in the help screen.
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.
lol misread your question so my response didn't actually answer your question but yes, it's for the categories in the help screen
🧰 Changes
Just some refactoring as part of the upcoming Changelog + Custom Pages functionality.
pushDoc
function to support more routes and check for generic 404s as opposed toDOC_NOTFOUND
errorsfilePath
instead offilepath
)docs
command into its own folder🧬 QA & Testing
Do tests pass?