npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generate-git-log-json

v1.1.1

Published

Print a configurable git log in json. Fork from git-log-to-json

Downloads

1

Readme

git-log-to-json

Style Status Build Status Coverage Status NPM Version

Print a configurable git log in json

Install

$ npm install git-log-to-json

CLI

Usage: git-log-to-json|git log-to-json <dir>

Print a configurable git log in json

Options:

  -h, --help          output usage information
  -V, --version       output the version number
  -H, --hash          output the commit hash
  -D, --date          output the commit date
  -N, --author-name   output the commit author name
  -E, --author-email  output the commit author email
  -S, --subject       output the commit subject
  -B, --body          output the commit body
  -L, --limit         limit the number of commit logged
  -P, --pretty        format the output with "\t"

Examples:

  $ git log-to-json .
  $ git log-to-json . --limit 3
  $ git log-to-json . --hash --date --author-name
  $ git log-to-json . -H -D --subject
  $ git log-to-json . -H -D -S -B --pretty
  $ ./bin/git-log-to-json . > history.json

API

require('git-log-to-json')(directory[, options])

  • directory <String> The directory to analyze. Must contain a .git directory
  • options <Object> An optional map of flags to configure the git log command:
    • hash <Boolean> Includes the commit hash
    • date <Boolean> Includes the commit date
    • subject <Boolean> Includes the commit subject
    • body <Boolean> Includes the commit body
    • authorEmail <Boolean> Includes the commit author email
    • authorName <Boolean> Includes the commit author name
    • limit <Integer> Limit the number of commit logged
    • pretty <Boolean> Format the output with \t
  • Return: <Promise> The promise resolved once the git log command is executed.

Examples

Given the commit:

feat(#420): node.js rocks

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
require('git-log-to-json')('.')
  .then((log) => {
    /* log will contain:
    [{
      "hash": "<hash>",
      "date": "2016-04-21T19:00:13+02:00",
      "subject": "feat(#420): node.js rocks",
      "body": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
      incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
      nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. ",
      "author": {
        "name": "Simon Renoult",
        "email": "[email protected]"
      }
    }]
     */
  })
  .catch((err) => {
    // do something
  })

require('git-log-to-json')('.', {hash: true, date: true, authorEmail: true})
  .then((log) => {
    /* log will contain:
    [{
      "hash": "<hash>",
      "date": "2016-04-21T19:00:13+02:00",
      "author": {
        "email": "[email protected]"
      }
    }]
     */
  })
  .catch((err) => {
    // do something
  })

Troubleshooting

The tests fail to run locally.

The test/mock/repo submodule might be missing. Clone git-log-to-json with the --recursive flag.

I installed git-log-to-json globally but the command is not found.

The command is still available, not to autocompletion though. This is due to git doing some fancy work. The autocompletion will work with git log-to-json.