This repository was archived by the owner on Dec 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33The future is now! Futuristic approach leveraging top-level await.
44
5- ``` js
5+ ``` js showLineNumbers title="src/util/version-check.js"
66const versionCheck = require (' github-version-checker' )
77const options = {
88 // token: '...',
@@ -12,6 +12,7 @@ const options = {
1212}
1313
1414try {
15+ // highlight-next-line
1516 const update = await versionCheck (options)
1617 if (update) { // update is null if there is no update available, so check here
1718 console .log (' An update is available! ' + update .name )
Original file line number Diff line number Diff line change 22
33Using a plain old callback.
44
5- ```` js
5+ ```` js showLineNumbers title="src/util/version-check.js"
66const versionCheck = require (' github-version-checker' )
77const options = {
88 // token: '...',
Original file line number Diff line number Diff line change 22
33Modern version using a Promise-based approach.
44
5- ``` js
5+ ``` js showLineNumbers title="src/util/version-check.js"
66const versionCheck = require (' github-version-checker' )
77const options = {
88 // token: '...',
Original file line number Diff line number Diff line change @@ -5,13 +5,14 @@ releases api won't work.
55
66Fetch the tags instead by setting ` fetchTags ` to ` true ` :
77
8- ``` js
8+ ``` js showLineNumbers title="src/util/version-check.js"
99const versionCheck = require (' github-version-checker' )
1010const options = {
1111 token: ' my-token' ,
1212 repo: ' github-version-checker' ,
1313 owner: ' axelrindle' ,
1414 currentVersion: require (' ../package.json' ).version ,
15+ // highlight-next-line
1516 fetchTags: true
1617}
1718
Original file line number Diff line number Diff line change @@ -4,9 +4,10 @@ There may be scenarios where you explicitly want to call the REST API.
44
55Set the ` token ` to ` false ` to accomplish this:
66
7- ``` js
7+ ``` js showLineNumbers title="src/util/version-check.js"
88const versionCheck = require (' github-version-checker' )
99const options = {
10+ // highlight-next-line
1011 token: false ,
1112 repo: ' github-version-checker' ,
1213 owner: ' axelrindle' ,
You can’t perform that action at this time.
0 commit comments