1
0
Fork 0
This commit is contained in:
Travis Fischer 2018-03-04 15:43:18 -05:00 committed by Joost De Cock
parent e80c3b2298
commit 907845feb1
27 changed files with 11082 additions and 0 deletions

View file

@ -0,0 +1,33 @@
'use strict'
const getGitConfigPath = require('git-config-path')
const githubUsername = require('github-username')
const parseGitConfig = require('parse-git-config')
const which = require('which')
module.exports = async () => {
const defaults = {
author: undefined,
manager: 'npm'
}
try {
const gitConfigPath = getGitConfigPath('global')
if (gitConfigPath) {
const gitConfig = parseGitConfig.sync({ path: gitConfigPath })
if (gitConfig.github && gitConfig.github.user) {
defaults.author = gitConfig.github.user
} else if (gitConfig.user && gitConfig.user.email) {
defaults.author = await githubUsername(gitConfig.user.email)
}
}
if (which.sync('yarn', { nothrow: true })) {
defaults.manager = 'yarn'
}
} catch (err) { }
return defaults
}