2.4.0 • Published 5 years ago

gitinfo v2.4.0

Weekly downloads
24,629
License
BSD-3-Clause
Repository
github
Last release
5 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

5 years ago

2.3.0

5 years ago

2.2.0

7 years ago

2.1.14

8 years ago

2.1.13

8 years ago

2.0.85

8 years ago

2.0.84

8 years ago

2.0.5

8 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.5

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago

0.0.2

12 years ago

0.0.1

12 years ago