Skip to content

Break Git commits into object streams

Notifications You must be signed in to change notification settings

delta62/editcount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

editcount

Break git commits into a stream of metadata objects, like this:

{
  hash: "8a6b02108fc1ff9feb30a6c0405fca9600f9a4a6",
  authorName: "Sam Noedel",
  authorEmail: "sam.noedel@example.com",
  timestamp: 123456789,
  filename: "test.ts",
  isCreated: true,
  isDeleted: false,
  isRename: false,
  additions: 42,
  deletions: 0
}

You can either access the data via a node Readable stream, or from an rxjs observable. If you want to invoke the library from the command line, check out @noedel/commit-stats.

Usage

yarn add @noedel/editcount

⚠️ Always validate the options of this library! It is invoking the git command via child_process.spawn, so you should be absolutely certain the inputs are safe to run. ⚠️

With an rxjs observable:

import { edits } from '@noedel/editcount'
// or import edits from '@noedel/editcount'

editStream({
  from '8a6b02108fc1ff9feb30a6c0405fca9600f9a4a6',
  to: '92e5030b918cc2a303de4f5056cde4506beb6eba',
  cwd: '/home/person/repo'
}).subscribe(
  console.log.bind(console),
  console.error.bind(console)
)

With a node Readable stream:

import { editStream } from '@noedel/editcount'

let stream = editStream({
  from '8a6b02108fc1ff9feb30a6c0405fca9600f9a4a6',
  to: '92e5030b918cc2a303de4f5056cde4506beb6eba',
  cwd: '/home/person/repo'
})

stream.on('data', console.log.bind(console))
stream.on('error', console.error.bind(console))

License

MIT

About

Break Git commits into object streams

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published