Installations
npm install git-log-parser
Releases
Unable to fetch releases
Developer
bendrucker
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
20.12.0
NPM Version
10.5.0
Statistics
24 Stars
31 Commits
11 Forks
3 Watching
3 Branches
3 Contributors
Updated on 01 Jul 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
181,619,202
Last day
8.4%
357,470
Compared to previous day
Last week
9.1%
1,914,617
Compared to previous week
Last month
32%
6,974,007
Compared to previous month
Last year
30.8%
58,102,683
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
git-log-parser
Run git log
and return a stream of commit objects.
Setup
1$ npm install git-log-parser
API
log.parse(config, options)
-> Stream(commits)
Accepts a config
object mapping to the options accepted by git log
. config
will be automatically converted to command line options and flags by argv-formatter. Returns a stream of commit objects.
options
is passed directly to child_process.spawn
.
A commit is structured as follows:
1{ 2 commit: { 3 'long': '4bba6092ecb2571301ca0daa2c55336ea2c74ea2', 4 'short': '4bba609' 5 }, 6 tree: { 7 'long': 'b4ef3379e639f8c0034831deae8f6ce63dd41566', 8 'short': 'b4ef337' 9 }, 10 author: { 11 'name': 'Ben Drucker', 12 'email': 'bvdrucker@gmail.com', 13 'date': new Date('2014-11-20T14:39:01.000Z') 14 }, 15 committer: { 16 'name': 'Ben Drucker', 17 'email': 'bvdrucker@gmail.com', 18 'date': new Date('2014-11-20T14:39:01.000Z') 19 }, 20 subject: 'Initial commit', 21 body: 'The commit body' 22}
author.date
and commiter.date
are Date
objects while all other values are strings.
If you just want an array of commits, use stream-to-array to wrap the returned stream.
log.fields
-> Object
Commit objects contain the most frequently used commit information. However, the field mappings used to format and then parse log output can be amended before calling the parser. Consult the full range of formatting placeholders and add the placeholder to the object tree if you wish to add extra fields.
Example
Get all commits from earlier than an hour ago and stream them to stdout
as pretty-printed JSON
1var log = require('git-log-parser'); 2var through2 = require('through2'); 3 4log.parse({ 5 before: new Date(Date.now() - 60 * 60 * 1000) 6}) 7.pipe(through2.obj(function (chunk, enc, callback) { 8 callback(null, JSON.stringify(chunk, undefined, 2)); 9})) 10.pipe(process.stdout);
Note that before
is stringified and passed directly as an argument to git log
. No special handling is required for any standard git log
option. You can filter by committer, time, or any other field supported by git log
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Score
3
/10
Last Scanned on 2024-11-25
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