# autoversion-git

> Display version on websites using github release / commits

Latest version **0.1.4** (published 2020-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install autoversion-git
pnpm add autoversion-git
yarn add autoversion-git
bun add autoversion-git
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2020-05-02 |
| First published | 2020-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | kingspp |
| Maintainers | kingspp |
| Keywords | version, auto, github |

## Links

- npm: https://www.npmjs.com/package/autoversion-git
- Repository: https://github.com/kingspp/autoversion
- Homepage: https://github.com/kingspp/autoversion#readme
- Issues: https://github.com/kingspp/autoversion/issues
- npm.io page: https://npm.io/package/autoversion-git

## Recent versions

- 0.1.4 (latest) — 2020-05-02
- 0.1.3 — 2020-05-02
- 0.1.2 — 2020-05-02
- 0.1.1 — 2020-05-02

## README

# Autoversion [![Build Status](https://travis-ci.com/YOUR-GITHUB-USERNAME/unicorn-fun.svg?branch=master)](https://travis-ci.com/YOUR-GITHUB-USERNAME/unicorn-fun)

> Display Version on your websites using github releases / commits 

## Example
### Sample Repository
![Header](https://github.com/kingspp/autoversion/blob/master/assets/inp.png?raw=true)

### Fetched Repository
![Header](https://github.com/kingspp/autoversion/blob/master/assets/exp1.png?raw=true)
![Footer](https://github.com/kingspp/autoversion/blob/master/assets/exp2.png?raw=true)

## Getting started

## Install

```
$ npm install autoversion-git
```

## Usage - Require (Node)

```js
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 

```js
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

---
_Source: https://npm.io/package/autoversion-git · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
