Skip to content

Commit

Permalink
added simple if statement to check if bower.json is available and fal…
Browse files Browse the repository at this point in the history
…lback to .bower.json
  • Loading branch information
Josh Lawrence committed May 20, 2015
1 parent 33270d3 commit b29df3b
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 b29df3b

Please sign in to comment.