How to use the parse-git-config.promise function in parse-git-config

To help you get started, we’ve selected a few parse-git-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xpack / xpm-js / lib / xpm / init.js View on Github external
const liquidMap = {}

    liquidMap.projectName = config.projectName
    // Return original if not a match.
    liquidMap.gitProjectName = config.projectName.replace(
      /^[@][a-zA-Z0-9-_]+[/]([a-zA-Z0-9-_]+)$/, '$1')

    const author = {}
    author.name = ''
    author.email = ''
    author.url = ''

    let gitConfig
    try {
      gitConfig = await parseGitConfig.promise()
    } catch (err) {
      try {
        gitConfig = await parseGitConfig.promise(
          {
            cwd: userHome,
            path: '.gitconfig'
          }
        )
      } catch (err) {
      }
    }
    if (gitConfig) {
      if (gitConfig.user && gitConfig.user.name) {
        author.name = gitConfig.user.name
      }
      if (gitConfig.user && gitConfig.user.email) {

parse-git-config

Parse `.git/config` into a JavaScript object. sync or async.

MIT
Latest version published 6 years ago

Package Health Score

71 / 100
Full package analysis