Skip to content

Commit

Permalink
Fix Jopyth#87 - Unhandled Error
Browse files Browse the repository at this point in the history
  • Loading branch information
shbatm committed Jan 4, 2019
1 parent 6d90715 commit 9208e23
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions node_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ module.exports = NodeHelper.create(Object.assign({
// now check for installed modules
fs.readdir(path.resolve(__dirname + "/.."), function(err, files) {
let installedModules = files.filter(f => ['node_modules', 'default', 'README.md'].indexOf(f) === -1);
installedModules.forEach((dir, i) => {
installedModules.forEach((dir, i, a) => {
self.addModule(dir, (i === installedModules.length - 1));
});
});
Expand Down Expand Up @@ -273,11 +273,16 @@ module.exports = NodeHelper.create(Object.assign({
if (error) {
console.log(error);
}
var baseUrl = result[0].refs.fetch;
// replacements
baseUrl = baseUrl.replace(".git", "").replace("github.com:", "github.com/");
// if cloned with ssh
currentModule.url = baseUrl.replace("git@", "https://");
try {
var baseUrl = result[0].refs.fetch;
// replacements
baseUrl = baseUrl.replace(".git", "").replace("github.com:", "github.com/");
// if cloned with ssh
currentModule.url = baseUrl.replace("git@", "https://");
} catch (e) {
// Something happened. Skip it.
return;
}
});
}
}
Expand Down

0 comments on commit 9208e23

Please sign in to comment.