You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 19, 2025. It is now read-only.
Performs an update check with the given options. The `callback` is optional, can be omitted to return a `Promise`.
15
18
16
-
####The `options` object
19
+
### The `options` object
17
20
Option | Description | Default Value | Introduction
18
21
--- | --- | --- | ---
19
22
token | A [personal access token](https://blog.github.com/2013-05-16-personal-api-tokens/) used to access the **Github GraphQL API (v4)**. Can be omitted and instead be read from an env variable called `GITHUB_API_TOKEN`. When no token can be found, the module will fall back to the **Github Rest API (v3)**. | `undefined` | `v2.0.0`
@@ -23,8 +26,9 @@ currentVersion | Your app's current version. | **None. Required.** | `v1.0.0`
23
26
fetchTags | Whether to fetch the repositories' git tags instead of the GitHub releases. Useful when no releases are created, but only tags. | `false` | `v1.0.0`
24
27
latestOnly | Setting this to `true` will fetch the latest release only | `false` | `v2.2.0`
25
28
excludePrereleases | Excludes pre-releases from checks. Currently only works when no token is specified. | `false` | `v2.3.0`
29
+
forceRest | Will use the Github REST API (v3) even with a supplied token. | `false` | `v3.0.0`
26
30
27
-
####The `callback` function (optional)
31
+
### The `callback` function (optional)
28
32
Should be of the following form:
29
33
```javascript
30
34
function(error, update) {
@@ -36,28 +40,64 @@ function(error, update) {
36
40
*`update`:
37
41
* An object in the format specified below. `null` if no update was found.
38
42
39
-
#### Using `Promise`
43
+
### Return type
44
+
45
+
The function returns a `CheckResult` which has the following structure:
46
+
47
+
```typescript
48
+
interfaceCheckResult {
49
+
src:string
50
+
type:string
51
+
update:ReleaseDescriptor|TagDescriptor|undefined
52
+
}
53
+
```
54
+
55
+
#### Properties
56
+
##### `src`
57
+
58
+
States which API endpoint has been used.
59
+
60
+
Possible values:
61
+
62
+
-`rest`
63
+
-`graphql`
64
+
65
+
##### `type`
66
+
67
+
States whether releases or tags have been fetched.
68
+
69
+
Possible values:
70
+
71
+
-`releases`
72
+
-`tags`
73
+
74
+
##### `update`
75
+
76
+
Holds the actual data on a possible update. For structure details refer to [Object schemes](#object-schemes).
77
+
78
+
It is `undefined` in case no update could be found.
79
+
80
+
### Using `Promise`
40
81
You can omit the `callback` function to return a `Promise`, which resolves with the `update` object.
41
82
42
-
###Object schemes
43
-
#### Releases
83
+
## Object schemes
84
+
###ReleaseDescriptor
44
85
When fetching releases, an object with the following structure will be returned:
45
-
```js
46
-
Object {
47
-
name
48
-
tag {
49
-
name
50
-
}
51
-
isPrerelease
52
-
publishedAt
53
-
url
86
+
```typescript
87
+
interfaceReleaseDescriptor {
88
+
name:string
89
+
tag:TagDescriptor
90
+
isPrerelease:boolean
91
+
isDraft:boolean
92
+
publishedAt:string
93
+
url:string
54
94
}
55
95
```
56
96
57
-
#### Tags
97
+
###TagDescriptor
58
98
When fetching tags, you will receive an object with the following structure:
0 commit comments