Skip to content
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

Merged
merged 3 commits into from
May 10, 2018
Merged

Conversation

kyeah
Copy link
Contributor

@kyeah kyeah commented May 6, 2018

Closes #152.

Adds a --config option to specify a custom configuration file, e.g.

gren release --config=.custom.grenrc.js

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 👋

@codecov-io
Copy link

codecov-io commented May 6, 2018

Codecov Report

Merging #163 into master will decrease coverage by 45.46%.
The diff coverage is 100%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
lib/_options.js 71.42% <ø> (ø) ⬆️
lib/src/Program.js 82.14% <100%> (ø) ⬆️
lib/src/_utils.js 100% <100%> (ø) ⬆️
lib/src/Gren.js 5.28% <0%> (-75.49%) ⬇️
lib/src/GitHubInfo.js 80.95% <0%> (-4.77%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ff8e2a...5c19fc7. Read the comment docs.

if (customFilename) {
return requireConfig(Path.join(path, customFilename)) || {};
} else {
return getFileTypes()
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

@alexcanessa alexcanessa merged commit 56551ae into github-tools:master May 10, 2018
@alexcanessa
Copy link
Member

@all-contributors please add @kyeah for code

@allcontributors
Copy link
Contributor

@alexcanessa

I've put up a pull request to add @kyeah! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add configuration-file option
3 participants