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.
yarn add @noedel/editcount
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))
MIT