Gathering detailed insights and metrics for git-describe
Gathering detailed insights and metrics for git-describe
Gathering detailed insights and metrics for git-describe
Gathering detailed insights and metrics for git-describe
npm install git-describe
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (98.62%)
Shell (1.38%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
36 Stars
78 Commits
5 Forks
3 Watchers
9 Branches
5 Contributors
Updated on Aug 28, 2024
Latest Version
4.1.1
Package Id
git-describe@4.1.1
Unpacked Size
16.09 kB
Size
5.54 kB
File Count
7
NPM Version
8.3.1
Node Version
16.14.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
4
1
This Node.js module runs git describe
on the working directory or any
other directory and parses the output to individual components. Additionally,
if your tags follow semantic versioning the semver will be parsed and
supplemented with the git-specific information as build metadata.
Available from npm:
npm install git-describe
Tests are not included in the npm package — clone the git repository to run tests (Node.js 4+ required).
As of version 4.0.0, semver
is an optional dependency that does not have to
be installed if you do not require semver functionality.
Note that the git
executable must be in the system's executable path for this module to function.
The module exposes two functions:
gitDescribe(directory, options, cb) -> Promise
gitDescribeSync(directory, options) -> Object
The only difference is that gitDescribe
has an asynchronous API
(either the callback argument or the returned promise can be used), whilst
gitDescribeSync
is fully synchronous
(blocks until the git executable returns and throws an Error
on failure).
Both functions can take a directory
string (defaults to working directory)
and an options
object. Either or both arguments can be omitted.
1const {gitDescribe, gitDescribeSync} = require('git-describe'); 2 3// Target working directory 4const gitInfo = gitDescribeSync(); 5 6// Target the directory of the calling script 7// Recommended when you want to target the repo your app resides in 8const gitInfo = gitDescribeSync(__dirname); 9 10// With options (see below) 11const gitInfo = gitDescribeSync(__dirname, { 12 longSemver: true, 13 dirtySemver: false 14}); 15 16// Another example: working directory, use 16 character commit hash abbreviation 17const gitInfo = gitDescribeSync({ 18 customArguments: ['--abbrev=16'] 19}); 20 21// Asynchronous with promise 22gitDescribe(__dirname) 23 .then((gitInfo) => console.dir(gitInfo)) 24 .catch((err) => console.error(err)); 25 26// Asynchronous with node-style callback 27gitDescribe(__dirname, (err, gitInfo) => { 28 if (err) 29 return console.error(err); 30 console.dir(gitInfo); 31});
1{ 2 dirty: false, 3 hash: 'g3c9c15b', 4 distance: 6, 5 tag: 'v2.1.0-beta', 6 semver: SemVer, // SemVer instance, see https://github.com/npm/node-semver 7 suffix: '6-g3c9c15b', 8 raw: 'v2.1.0-beta-6-g3c9c15b', 9 semverString: '2.1.0-beta+6.g3c9c15b' 10}
Option | Default | Description |
---|---|---|
dirtyMark | '-dirty' | Dirty mark to use if repo state is dirty (see git describe's --dirty ). |
dirtySemver | true | Appends the dirty mark to semverString if repo state is dirty. |
long | true | Always adds commit distance and hash to raw , suffix and .toString() (matches the behaviour of git describe's --long ) |
longSemver | false | Always adds commit distance and hash to semverString (similar to git describe's --long , but for semver). |
requireAnnotated | false | Uses --tags if false, so that simple git tags are allowed. |
match | 'v[0-9]*' | Uses --match to filter tag names. By default only tags resembling a version number are considered. |
customArguments | [] | Array of additional arguments to pass to git describe . Not all arguments are useful and some may even break the library, but things like --abbrev and --candidates should be safe to add. |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
Found 4/7 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
7 existing vulnerabilities detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More