generator-taskr icon indicating copy to clipboard operation
generator-taskr copied to clipboard

How about getting GitHub username with GitHub API ?

Open sotayamashita opened this issue 10 years ago • 13 comments

Like yeoman/generator-generator/app/index.js.

var GitHubApi = require('github');

github.user.getFrom({
    user: name
  }, function (err, res) {
    if (err) {
      log.error('Cannot fetch your github profile. Make sure you\'ve typed it correctly.');
      res = emptyGithubRes;
    }

    cb(JSON.parse(JSON.stringify(res)));
})

sotayamashita avatar Jul 09 '15 07:07 sotayamashita

If this necessary there is a wrapper module called gh-user

var ghUser = require('gh-user');

ghUser('sindresorhus', function (err, user) {
    console.log(user);
    //=> { login: 'sindresorhus', id: 170270, ... }
});

It will be like this. @bucaran what do you think, seems interesting?

hzlmn avatar Jul 09 '15 07:07 hzlmn

@sotayamashita @drKraken Cool. So, we get the username from the user and use gh-user to find the URL. But what's the advantage for generator-fly exactly?

Thanks!

ghost avatar Jul 09 '15 07:07 ghost

@bucaran You could get email, websites in such way and not add separate promt for it. But i not like this, it's more dependencies, dependencies => issues in future

hzlmn avatar Jul 09 '15 07:07 hzlmn

@drKraken I see, we do ask for the email, but once you type it once it goes into the cache so you don't have to retype it each time you use the generator. As for the website, by default → github.com/USER_NAME.

So, while I think this is a nice feature to have, but we can give it low priority for now.

@sotayamashita If this becomes an issue in the future we can refer back to this issue.

:smile:

ghost avatar Jul 09 '15 07:07 ghost

@drKraken can I implement this feature ?

sotayamashita avatar Jul 09 '15 07:07 sotayamashita

@sotayamashita Sure. Go for it and send a PR.

ghost avatar Jul 09 '15 07:07 ghost

@drKraken :+1:

sotayamashita avatar Jul 09 '15 07:07 sotayamashita

@sotayamashita absolutely

hzlmn avatar Jul 09 '15 07:07 hzlmn

:construction: - https://github.com/sotayamashita/generator-fly/tree/feature/github-username

sotayamashita avatar Jul 09 '15 17:07 sotayamashita

@sotayamashita i don't see any differences, what's a point?

hzlmn avatar Jul 10 '15 14:07 hzlmn

@sotayamashita Updates? :smile:

ghost avatar Aug 16 '15 18:08 ghost

@bucaran sorry not to develop. I am so busy now but I am developing now.

sotayamashita avatar Aug 17 '15 02:08 sotayamashita

imo, no real need for this. current flow is very smooth & fast

lukeed avatar Jan 01 '16 20:01 lukeed