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

Commit 2eeb33f

Browse files
authored
Merge pull request #9 from seidnerj/master
Added an option to filter out prereleases
2 parents db257a2 + 83002b1 commit 2eeb33f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/check.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ const rest = (options, callback) => {
8080
let version = null;
8181
for (let i = 0; i < json.length; i++) {
8282
version = json[i];
83+
84+
if (options.excludePrereleases) {
85+
if(version['prerelease'] !== undefined && version['prerelease']) {
86+
continue;
87+
}
88+
}
89+
8390
if (semver.gt(version[options.fetchTags ? 'name' : 'tag_name'], options.currentVersion)) {
8491
found = true;
8592
break;
@@ -161,6 +168,11 @@ module.exports = (options, callback) => {
161168
// decide what to do
162169
// when we have a token supplied, we will call the GraphQL api
163170
if (options.token) {
171+
172+
if (options.excludePrereleases) {
173+
throw new Error('excludePrereleases option currently unsupported when specifying a token.');
174+
}
175+
164176
graphql(options, callback);
165177
} else {
166178
rest(options, callback);

0 commit comments

Comments
 (0)