Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit cb0db28

Browse files
author
Axel Rindle
committed
Update README.md
1 parent 9972b71 commit cb0db28

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ Simple **version checker** working with **GitHub releases** and the **GitHub API
33

44
## Install
55
```bash
6-
npm install --save github-version-checker
6+
$ npm install github-version-checker
7+
```
8+
or
9+
```bash
10+
$ yarn install github-version-checker
711
```
812

913
## Usage
@@ -18,7 +22,8 @@ const options = {
1822
currentVersion: pkg.version, // your app's current version
1923
includePreReleases: false // if you want to check pre-releases to
2024
};
21-
versionCheck(options, function (update) { // callback function
25+
versionCheck(options, function (update, error) { // callback function
26+
if (error) throw error;
2227
if (update) { // print some update info if an update is available
2328
console.log('An update is available!');
2429
console.log('New version: ' + update.tag_name);
@@ -35,16 +40,29 @@ Check the [examples folder](https://github.com/axelrindle/github-version-checker
3540
### Note on semantic versioning
3641
Always try to follow a clear [semver format](http://semver.org/). This helps to avoid parsing mistakes and getting a clear result.
3742

38-
## Options
43+
## API
44+
### `function versionCheck(options, [callback])`
45+
Performs an update check with the given options. The `callback` is optional, can be left out to return a `Promise`.
46+
47+
#### The `options` object
3948
Option | Default value | Description
4049
--- | --- | ---
4150
repo | **None. Required option** | Defines from which GitHub repository to load releases from.
4251
currentVersion | **None. Required option** | Your app's current version. Needed to check if a newer release is found.
4352
includePreReleases | false | Whether or not to include pre-releases. **Note:** This will fetch **all** releases, which might result in high traffic, depending on how much releases your app has on GitHub.
4453

45-
## The `update` object
46-
The object you receive in the callback function, follows the format specified here:
47-
https://developer.github.com/v3/repos/releases/#get-a-single-release
54+
#### The `callback` function (optional)
55+
Should be of the following form:
56+
```javascript
57+
function(update, error) {
58+
// ...your code
59+
}
60+
```
61+
* `update`:
62+
* An object in the format specified [here](https://developer.github.com/v3/repos/releases/#get-a-single-release). `null` if no update was found.
63+
* `error`:
64+
* If an error occurs, this holds the error message. `null` if no error occurs.
65+
4866

4967
## Todo
5068

0 commit comments

Comments
 (0)