gitinfo

Gets information about a Git repository.

BSD-3-Clause 26 个版本
安装
npm install gitinfo
yarn add gitinfo
pnpm add gitinfo
bun add gitinfo
README

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 2019-07-13
2.3.0 2019-07-12
2.2.0 2017-07-20
2.1.14 2016-09-05
2.1.13 2016-09-05
2.0.85 2016-08-23
2.0.84 2016-08-22
2.0.5 2016-08-22
2.0.4 2016-08-22
2.0.3 2016-08-15
2.0.2 2016-08-15
2.0.1 2016-08-09
2.0.0 2016-08-09
1.3.0 2016-08-09
1.2.2 2015-10-26
1.2.1 2015-10-26
1.2.0 2015-10-22
1.1.5 2015-10-22
1.1.4 2015-10-21
1.1.3 2015-09-23
1.1.2 2014-12-09
1.1.1 2014-12-02
1.1.0 2014-11-18
1.0.0 2014-11-18
0.0.2 2012-09-18
0.0.1 2012-09-18