repoinfojs
v1.1.1
Published
Retrieves information about the current state of the repository
Downloads
11
Readme
RepoInfoJS - Simple repository information function
Usage:
import getRepoInfo from 'repoinfojs'
const info = await getRepoInfo()
console.log(info)
/* Output:
{ formatted: 'master-1',
branch: 'master',
hash: 'b5508f6',
hashFull: 'b5508f67e32948b49dcd9b3c2dd1e0afe53bbf89',
commits: '1',
lastCommit: 'Tue, 4 Sep 2018 00:21:53 +0200',
lastCommitRel: '5 days ago' } */
You can pass one additional argument:
getUname
(String|Array) - Passing a string here will cause the output ofuname
to be included as well. E.g. passing'-n'
will rununame -n
and include the output. You can include an array of strings as well.
For example:
import getRepoInfo from 'repoinfojs'
const info = await getRepoInfo(['-n', '-m'])
console.log(info)
/* Output:
{ formatted: 'master-1',
branch: 'master',
hash: 'b5508f6',
hashFull: 'b5508f67e32948b49dcd9b3c2dd1e0afe53bbf89',
commits: '1',
lastCommit: 'Tue, 4 Sep 2018 00:21:53 +0200',
lastCommitRel: '5 days ago',
uname: [ 'Vesuvius.local', 'x86_64' ] } */
This function uses external calls and returns a Promise
. In case of an error, all null
values are returned.
Copyright
MIT license.