-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Better config resolving #37
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Charlike Mike Reagent <olsten.larck@gmail.com>
lib/readMaidFile.js
Outdated
*/ | ||
module.exports = (opts = {}) => { | ||
let filepath = | ||
find.sync(MAIDFILE, opts.cwd, 5) || find.sync(`.${MAIDFILE}`, opts.cwd, 10) |
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.. i forgot that, but it's not needed for find-file-up
to work it uses the cwd by default anyway.
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.
use of the --cwd
flag is not encouraged anyway, because it also may conflict with other CLIs (#35)
Signed-off-by: Charlike Mike Reagent <olsten.larck@gmail.com>
Signed-off-by: Charlike Mike Reagent <olsten.larck@gmail.com>
Btw, last commit may look strange, but is required and this problem probably comes from the you can see here how there is
Definitely this should somehow be handled by Like for example running lint task
should represent
? That's why #35 is reasonable and mostly sure it may appear as problem in future, and users should be caution when use |
TODO: update docs. |
@tunnckoCore, I have access to start merging, would you fix the conflicts and I will merge today. Thanks. |
*/ | ||
module.exports = (opts = {}) => { | ||
let filepath = | ||
find.sync(MAIDFILE, null, 5) || find.sync(`.${MAIDFILE}`, null, 10) |
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.
What about simply using loadFile
? It by default will stop searching files when reaching /
.
loadFile.loadSync(['maidfile.md', '.maidfile.md'])
// not sure why we need to support .maidfile.md though
And remove the stopDir
here:
Line 7 in d2108b5
stopDir: path.dirname(process.cwd()) |
resolves #4 and deprecates #36 and #29 ;d
So what is the final result? There is a comment, but let's describe again.
If someone want one global config file they don't need to do anything or to use a
--maidfile
flag - it just works. It will look 5-10 directories up to find such file, otherwise you should pass path to a markdown file (e.g.README.md
or~/myconfigs/maidconfig.md
) which has h2 header and tasks names as h3 headers, the optional use of<!-- maid-tasks -->
still work though.