-
Notifications
You must be signed in to change notification settings - Fork 325
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
Add custom --config option #163
Conversation
Codecov Report
@@ Coverage Diff @@
## master #163 +/- ##
===========================================
- Coverage 83.72% 38.26% -45.47%
===========================================
Files 7 7
Lines 338 345 +7
===========================================
- Hits 283 132 -151
- Misses 55 213 +158
Continue to review full report at Codecov.
|
lib/src/_utils.js
Outdated
if (customFilename) { | ||
return requireConfig(Path.join(path, customFilename)) || {}; | ||
} else { | ||
return getFileTypes() |
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 do you think about about:
return [].concat(customFilename, getFileTypes())
.reduce() || {};
So that, if the user passes a wrong configuration file, gren will still look for existing ones.
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.
Good call! Since the user is passing a specific config filename in, they're expecting the file to exist — do you think it'd be more user-friendly to throw an error here and notify them that the file wasn't found?
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.
Definitely! I think we either check if other configuration files exist or we throw an error - as logging something in red in the console - which is still a good solution for me.
@all-contributors please add @kyeah for code |
I've put up a pull request to add @kyeah! 🎉 |
Closes #152.
Adds a
--config
option to specify a custom configuration file, e.g.Note that a plain grenrc file can only contain one
.
, so--custom=.custom.grenrc
will be parsed incorrectly (see the check here). I left it alone for now, but if you have a preference for how it should behave, let me know 👋