-
Notifications
You must be signed in to change notification settings - Fork 482
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
feat(config): add file property for notes #614
Conversation
if (typeof val.file === 'string') { | ||
var filename = path.join(process.cwd(), val.file); | ||
try { | ||
val.description = fs.readFileSync(filename).toString(); |
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 is currently sync because this pipeline is currently all sync. I can also move it to the async version if that's preferred but that would mean changing more in this file and the interface to sort
.
@@ -36,6 +38,15 @@ module.exports = function sortDocs(comments, options) { | |||
var fixed = options.toc.filter(function (val) { | |||
return typeof val === 'object' && val.name; | |||
}).map(function (val) { | |||
if (typeof val.file === 'string') { | |||
var filename = path.join(process.cwd(), val.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.
Thinking about this more, in a case like
documentation build --config=some/directory/documentation.yml index.js
The paths in documentation.yml
should be relative to some/directory
rather than to ./
. In that case, we might want to add the config path when we go through configParser (docs for that on yargs), so that sort
can use it as a relative path if it's present.
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've changed it so that
- if loading through the config, the file is resolved by that path.
- sort.js checks for absolute paths and uses them if found, otherwise it resolves against
process.cwd()
👍 Awesome, thanks! This is great work. Out of curiosity: the naming convention that you're using for the commit message (like |
@tmcw yes long ingrained habit those commit messages :) I've been using the conventional-changelog family of tooling for some time in all my projects and are pretty happy with it. If you want some details and infos on tooling around this I collected some info recently here: ipfs/aegir#30 |
Fixes #609