repoinfojs

1.1.1 • Public • Published

npm version License: MIT

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 of uname to be included as well. E.g. passing '-n' will run uname -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.

Readme

Keywords

none

Package Sidebar

Install

npm i repoinfojs

Weekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

11.3 kB

Total Files

7

Last publish

Collaborators

  • msikma