Don't break if there is no git remote info

This commit is contained in:
Jeroen Engels 2016-05-10 15:39:44 +02:00
parent 31af204714
commit dfc20fc8d9
2 changed files with 8 additions and 2 deletions

View file

@ -54,8 +54,10 @@ module.exports = function prompt(cb) {
if (error) {
return cb(error);
}
questions[0].default = repoInfo.projectName;
questions[1].default = repoInfo.projectOwner;
if (repoInfo) {
questions[0].default = repoInfo.projectName;
questions[1].default = repoInfo.projectOwner;
}
inquirer.prompt(questions, function treatAnswers(answers) {
var config = {
projectName: answers.projectName,

View file

@ -21,6 +21,10 @@ function getRemoteOriginData(cb) {
function parse(originUrl) {
var result = /:(\w+)\/([A-Za-z0-9-_]+)/.exec(originUrl);
if (!result) {
return null;
}
return {
projectOwner: result[1],
projectName: result[2]