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

Commit 5397d6d

Browse files
author
Axel Rindle
committed
Add example for using the rest api
1 parent 998b79e commit 5397d6d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

examples/rest.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
// register coffeescript
5+
require('coffeescript/register');
6+
7+
const versionCheck = require('../lib/main');
8+
const options = {
9+
token: '',
10+
repo: 'github-version-checker',
11+
owner: 'axelrindle',
12+
currentVersion: require('../package.json').version
13+
};
14+
15+
versionCheck(options)
16+
.then(function (update) {
17+
if (update) { // update is null if there is no update available, so check here
18+
console.log("An update is available! " + update.name);
19+
console.log("You are on version " + options.currentVersion + "!");
20+
} else {
21+
console.log("You are up to date.");
22+
}
23+
})
24+
.catch(function (error) {
25+
console.error(error);
26+
});

0 commit comments

Comments
 (0)