Skip to content

Commit

Permalink
Merge pull request #1 from YPCrumble/issue-11
Browse files Browse the repository at this point in the history
added simple if statement to check if bower.json is available and fal…
  • Loading branch information
YPCrumble committed Jun 17, 2015
2 parents 33270d3 + b29df3b commit 8df72c5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ function bowerResolveSync(moduleArg, opts){
}

function getModulePath(thisModuleName){
var moduleConfig = fs.readFileSync([basePath, bowerDirRelPath, thisModuleName, 'bower.json'].join('/')),
relFilePath = thisModuleName + "." + fileExts[0];
var moduleConfig;

if ( fs.existsSync( [basePath, bowerDirRelPath, thisModuleName, 'bower.json'].join('/') ) ) {
moduleConfig = fs.readFileSync([basePath, bowerDirRelPath, thisModuleName, 'bower.json'].join('/'));
} else {
moduleConfig = fs.readFileSync([basePath, bowerDirRelPath, thisModuleName, '.bower.json'].join('/'));
}
var relFilePath = thisModuleName + "." + fileExts[0];

if(moduleConfig){
moduleConfig = JSON.parse(moduleConfig).main;
Expand Down

0 comments on commit 8df72c5

Please sign in to comment.