gh-release-fetch
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -10,1 +10,2 @@ export interface Release { | ||
export declare function fetchVersion(release: Release): Promise<void>; | ||
export declare function updateAvailable(repository: string, currentVersion: string): Promise<boolean>; |
@@ -14,2 +14,3 @@ "use strict"; | ||
const node_fetch_1 = require("node-fetch"); | ||
const semver_1 = require("semver"); | ||
function fetchLatest(release) { | ||
@@ -29,2 +30,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.fetchVersion = fetchVersion; | ||
function updateAvailable(repository, currentVersion) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const latestVersion = yield resolveRelease(repository); | ||
return semver_1.gt(latestVersion, currentVersion); | ||
}); | ||
} | ||
exports.updateAvailable = updateAvailable; | ||
function resolveRelease(repository) { | ||
@@ -31,0 +39,0 @@ return __awaiter(this, void 0, void 0, function* () { |
{ | ||
"name": "gh-release-fetch", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A library to fetch release binaries from GitHub Releases", | ||
@@ -24,6 +24,8 @@ "main": "dist/index.js", | ||
"@types/node-fetch": "^2.1.6", | ||
"@types/semver": "^5.5.0", | ||
"download": "^7.1.0", | ||
"mkdirp": "^0.5.1", | ||
"node-fetch": "^2.3.0" | ||
"node-fetch": "^2.3.0", | ||
"semver": "^5.6.0" | ||
} | ||
} |
import * as download from 'download'; | ||
import * as mkdirp from 'mkdirp'; | ||
import fetch from 'node-fetch'; | ||
import { gt } from 'semver'; | ||
@@ -23,2 +24,7 @@ export interface Release { | ||
export async function updateAvailable(repository: string, currentVersion: string): Promise<boolean> { | ||
const latestVersion = await resolveRelease(repository); | ||
return gt(latestVersion, currentVersion); | ||
} | ||
async function resolveRelease(repository: string): Promise<string> { | ||
@@ -25,0 +31,0 @@ const res = await fetch(`https://api.github.com/repos/${repository}/releases/latest`); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7510
168
8
+ Added@types/semver@^5.5.0
+ Addedsemver@^5.6.0
+ Added@types/semver@5.5.0(transitive)
+ Addedsemver@5.7.2(transitive)