Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

glg

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glg

Git log parser

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

glg

Build Status Greenkeeper badge

Get parsed git log data easily for analysis

Install

glg needs node >= 6.x.x

$ yarn add glg
# or npm install glg --save

Usage

This example uses async/await, but you can simply use Promise.

const glg = require('glg');

(async () => {
  const results: Array<Commit> = await glg(process.cwd());

  // do something
})();

By default glg will use #~#^# as commit separator and ^^^ as commit info separator. If for some reason your commits contain those characters, it will mess up the parsing. You can change it through 2nd arguments

const options = {
  // separator between commits
  separator: 'xxxx',
  // separator between commit information in single commit
  infoSeparator: 'yyyy',
};
const results = await glg(process.cwd(), options)

By default glg will only provides a few info inside a single commit. You can also provides custom commit data map if you want more information on your git log by using commitDataMap option

// These are default commit data map
// It maps object property that will be returned in array of result
// and uses its value to generate data, for example '%h' is used to retrieve
// commit hash. More information can be found in `git log --format`
const commitDataMap = {
  commitHash: "%h",
  authorEmail: "%ae",
  authorName: "%an",
  subject: "%s",
  createdDate: "%ad",
  publishedDate: "%cd"
};
const results = glg(process.cwd(), { commitDataMap });

Type Definition

type Commit = CommitDataMap & {
  changes: Array<Change>,
};

type Change = BasicChange | RenameChange;

type BasicChange = {
  type: string,
  path: string,
};

type RenameChange = {
  type: string,
  path: string,
  from: string,
};

CLI

$ yarn global add glg
# or npm install -g glg

$ glg ~/git/directory
# or npx glg ~/git/directory

License

MIT

Keywords

FAQs

Package last updated on 30 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc