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

Components by dir cleanup #447

Merged
merged 2 commits into from
Apr 7, 2017
Merged

Components by dir cleanup #447

merged 2 commits into from
Apr 7, 2017

Conversation

matteofigus
Copy link
Member

See inline comments.

@matteofigus matteofigus changed the title Components by dir cleanup [wip] Components by dir cleanup Apr 7, 2017
return false;
}
try {
content = fs.readJsonSync(packagePath);
Copy link
Member Author

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, []);
Copy link
Member Author

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(){
Copy link
Member Author

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)){
Copy link
Member Author

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, [])

@matteofigus matteofigus changed the title [wip] Components by dir cleanup Components by dir cleanup Apr 7, 2017
Copy link
Collaborator

@federicomaffei federicomaffei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@federicomaffei federicomaffei merged commit e383b7d into master Apr 7, 2017
@matteofigus matteofigus deleted the housekeeping branch April 7, 2017 16:58
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.

2 participants