2.4.0 • Published 6 years ago

gitinfo v2.4.0

Weekly downloads
24,629
License
BSD-3-Clause
Repository
github
Last release
6 years ago

gitinfo

Travis build status NPM version Canonical Code Style

Gets information about Git repository.

Implementation

gitinfo reads the contents of the ./git directory to extract information.

API

import createGitinfo from 'gitinfo';

/**
 * @typedef Configuration
 * @property {string} [defaultBranchName] Default branch name to fallback to. Default: throws an error if branch cannot be resolved.
 * @property {string} [gitPath] Path used to resolve .git path. Defaults to `__dirname`.
 */

/**
 * @access public
 * @name createGitinfo
 * @param {Configuration} userConfig
 */
const gitinfo = createGitinfo();

/**
 * Returns **Any** GitHub repository URL.
 */
gitinfo.getGithubUrl();

/**
 * Returns **Any** Name of the current branch.
 */
gitinfo.getBranchName();

/**
 * Returns **Any** Remote URL of the current branch.
 */
gitinfo.getRemoteUrl();

/**
 * Returns **Any** Absolute path to the .git/ directory.
 */
gitinfo.getGitPath();

/**
 * Returns **Any** Username of the repository author.
 */
gitinfo.getUsername();

/**
 * Returns **Any** Repository name.
 */
gitinfo.getName();

/**
 * Returns **Any** Commit SHA of the current branch.
 */
gitinfo.getHeadSha();

/**
 * Returns **Any** Representation of the .git/config file.
 */
gitinfo.getConfig();

Download

Download using NPM:

npm install gitinfo
2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

8 years ago

2.1.14

9 years ago

2.1.13

9 years ago

2.0.85

9 years ago

2.0.84

9 years ago

2.0.5

9 years ago

2.0.4

9 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

11 years ago

1.1.1

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago

0.0.2

13 years ago

0.0.1

13 years ago