-
Notifications
You must be signed in to change notification settings - Fork 122
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
Components by dir cleanup #447
Conversation
return false; | ||
} | ||
try { | ||
content = fs.readJsonSync(packagePath); |
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.
Previous behaviour was to check dir existed, check package.json existed, and then trying to read. For simplicity, let's just try to read the Json in that folder. If it's a component, it will be there. If it's not, let's skip the dir.
} catch(err){ | ||
return callback(err); | ||
return callback(null, []); |
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.
if the dir can't be read because is protected or doesn't exist, let's just say we didn't find anything.
@@ -11,8 +11,7 @@ var packageComponents = require('./package-components'); | |||
var mock = require('./mock'); | |||
var validator = require('../../registry/domain/validators'); | |||
|
|||
module.exports = function(dependencies){ | |||
var logger = dependencies.logger; | |||
module.exports = function(){ |
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.
no way logger should be exposed outside of CLI facades...
callback(err); | ||
return log.err(err); | ||
} else if(_.isEmpty(components)){ | ||
if(_.isEmpty(components)){ |
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 won't error anymore. In case no components are found, it will yield (null, [])
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.
👍
See inline comments.