-
Notifications
You must be signed in to change notification settings - Fork 93
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
throw error if nothing to inject #249
base: master
Are you sure you want to change the base?
Conversation
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 change will be a breaking change, so the commit message should be something more like:
feat: throw error if nothing to inject
BREAKING CHANGE: instead of logging when nothing was injected an error will be thrown
(Side note: I guess you made this PR from the GitHub UI, or locally without running npm install
first, because the git hook that validates the commit message apparently hasn't been run. Conventional Commits should be used)
src/inject/index.js
Outdated
@@ -110,7 +110,7 @@ function getNewContent(target, collection, opt) { | |||
var pluralState = filesCount > 1 ? 's' : ''; | |||
log(cyan(filesCount) + ' file' + pluralState + ' into ' + magenta(target.relative) + '.'); | |||
} else { | |||
log('Nothing to inject into ' + magenta(target.relative) + '.'); | |||
error('Nothing to inject into ' + magenta(target.relative) + '.'); |
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.
You'll need a throw
here as well, otherwise nothing will happen, it won't even log anything...
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.
Done
src/inject/index.js
Outdated
@@ -110,7 +110,7 @@ function getNewContent(target, collection, opt) { | |||
var pluralState = filesCount > 1 ? 's' : ''; | |||
log(cyan(filesCount) + ' file' + pluralState + ' into ' + magenta(target.relative) + '.'); | |||
} else { | |||
log('Nothing to inject into ' + magenta(target.relative) + '.'); | |||
error('Nothing to inject into ' + magenta(target.relative) + '.'); |
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 also suggest adding a test for this
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.
Added tests for both error and log if there is nothing to inject
Hi @joakimbeng , What about adding an option And yes made the PR from GitHub UI :) |
37ba0c8
to
294ae05
Compare
fbe5cd2
to
eb4a618
Compare
Hi @joakimbeng , Please review when you have time. Thanks |
Hey @joakimbeng, is there a chance to merge this PR? |
No description provided.