autoversion-git
v0.1.4
Published
Display version on websites using github release / commits
Downloads
2
Readme
Autoversion
Display Version on your websites using github releases / commits
Example
Sample Repository
Fetched Repository
Getting started
Install
$ npm install autoversion-git
Usage - Require (Node)
const autoversion = require('autoversion-git');
let owner = 'getredash'
let repo = 'redash'
let shaOrBranch = 'master'
// Create version based on latest release
const version = autoversion.getReleaseVersion(owner, repo, shaOrBranch);
// Create version based on number of commits
let digits = 3
const version = autoversion.getCommitVersion(owner, repo, shaOrBranch, digits);
Usage - VueJS/React
import {getCommitVersion, getReleaseVersion} from 'autoversion';
let owner = 'getredash'
let repo = 'redash'
let shaOrBranch = 'master'
// Create version based on latest release
const version = getReleaseVersion(owner, repo, shaOrBranch);
// Create version based on number of commits
let digits = 3
const version = getCommitVersion(owner, repo, shaOrBranch, digits);
API
getReleaseVersion(owner, repo)
owner
Type: string
Owner of the github repository
repo
Type: string
Repository Name
getCommitVersion(owner, repo, shaOrBranch, digits)
owner
Type: string
Owner of the github repository
repo
Type: string
Repository Name
shaOrBranch
Type: string
The option can take either sha - 6351cf255a30d166376737e831dea2cb4a1c39f9
or branch - master
digits
Type: int
Default: 3
The number of digits to show ex: 1234 commits and digits=3 => returns 1.2.3