@etclabscore/dl-github-releases
Advanced tools
Comparing version 1.0.9 to 1.1.0
@@ -1,2 +0,58 @@ | ||
declare const _default: (user: string, repo: string) => Promise<any>; | ||
export declare type Releases = Release[]; | ||
export interface Release { | ||
url: string; | ||
assets_url: string; | ||
upload_url: string; | ||
html_url: string; | ||
id: number; | ||
node_id: string; | ||
tag_name: string; | ||
target_commitish: string; | ||
name: string; | ||
draft: boolean; | ||
author: Author; | ||
prerelease: boolean; | ||
created_at: Date; | ||
published_at: Date; | ||
assets: Asset[]; | ||
tarball_url: string; | ||
zipball_url: string; | ||
body: string; | ||
} | ||
export interface Asset { | ||
url: string; | ||
id: number; | ||
node_id: string; | ||
name: string; | ||
label: string; | ||
uploader: Author; | ||
content_type: string; | ||
state: string; | ||
size: number; | ||
download_count: number; | ||
created_at: Date; | ||
updated_at: Date; | ||
browser_download_url: string; | ||
} | ||
export interface Author { | ||
login: string; | ||
id: number; | ||
node_id: string; | ||
avatar_url: string; | ||
gravatar_id: string; | ||
url: string; | ||
html_url: string; | ||
followers_url: string; | ||
following_url: string; | ||
gists_url: string; | ||
starred_url: string; | ||
subscriptions_url: string; | ||
organizations_url: string; | ||
repos_url: string; | ||
events_url: string; | ||
received_events_url: string; | ||
type: string; | ||
site_admin: boolean; | ||
} | ||
declare const _default: (user: string, repo: string) => Promise<Release[]>; | ||
export default _default; |
declare function pass(): boolean; | ||
/** | ||
* Todo: add typedoc | ||
* Gives a list of the releases made for a repository, optionally filtered by release | ||
* and/or based on inclusion of a particular asset. | ||
* | ||
* @param user the name of the user or organization that owns the repo | ||
* @param repo the name of the repository that you want to list releases of | ||
* @param filterRelease the release filter function | ||
* @param filterAsset the asset filter function | ||
*/ | ||
export default function downloadReleases(user: string, repo: string, outputDir: string, filterRelease?: typeof pass, filterAsset?: typeof pass, unzip?: boolean, consoleLogs?: boolean): Promise<string[]>; | ||
export declare function listReleases(user: string, repo: string, filterRelease?: typeof pass, filterAsset?: typeof pass): Promise<string[]>; | ||
/** | ||
* Downloads the releases for a particular repo, optionally filtered by release | ||
* and/or based on inclusion of a particular asset. | ||
* | ||
* @param user the name of the user or organization that owns the repo | ||
* @param repo the name of the repository that you want to list releases of | ||
* @param outputDir the relative path to a directory to write the downloaded releases to | ||
* @param filterRelease the release filter function | ||
* @param filterAsset the asset filter function | ||
* @param unzip pass true if you want it the result to be unzipped as well. | ||
*/ | ||
export default function downloadReleases(user: string, repo: string, outputDir: string, filterRelease?: typeof pass, filterAsset?: typeof pass, unzip?: boolean): Promise<string[]>; | ||
export {}; |
@@ -51,2 +51,3 @@ "use strict"; | ||
}; | ||
var _this = this; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -65,13 +66,7 @@ var fs_1 = require("fs"); | ||
} | ||
/** | ||
* Todo: add typedoc | ||
*/ | ||
function downloadReleases(user, repo, outputDir, filterRelease, filterAsset, unzip, consoleLogs) { | ||
var getFilteredReleases = function (user, repo, filterRelease, filterAsset) { | ||
if (filterRelease === void 0) { filterRelease = pass; } | ||
if (filterAsset === void 0) { filterAsset = pass; } | ||
if (unzip === void 0) { unzip = false; } | ||
if (consoleLogs === void 0) { consoleLogs = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var releases, filteredReleases, bigResult; | ||
var _this = this; | ||
return __awaiter(_this, void 0, void 0, function () { | ||
var releases, filteredReleases; | ||
return __generator(this, function (_a) { | ||
@@ -87,3 +82,59 @@ switch (_a.label) { | ||
}); | ||
return [4 /*yield*/, Promise.all(filteredReleases.map(function (release) { return __awaiter(_this, void 0, void 0, function () { | ||
return [2 /*return*/, filteredReleases]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Gives a list of the releases made for a repository, optionally filtered by release | ||
* and/or based on inclusion of a particular asset. | ||
* | ||
* @param user the name of the user or organization that owns the repo | ||
* @param repo the name of the repository that you want to list releases of | ||
* @param filterRelease the release filter function | ||
* @param filterAsset the asset filter function | ||
*/ | ||
function listReleases(user, repo, filterRelease, filterAsset) { | ||
if (filterRelease === void 0) { filterRelease = pass; } | ||
if (filterAsset === void 0) { filterAsset = pass; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var releases; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, getFilteredReleases(user, repo, filterRelease, filterAsset)]; | ||
case 1: | ||
releases = _a.sent(); | ||
return [2 /*return*/, releases.map(function (_a) { | ||
var tag_name = _a.tag_name; | ||
return tag_name; | ||
})]; | ||
} | ||
}); | ||
}); | ||
} | ||
exports.listReleases = listReleases; | ||
/** | ||
* Downloads the releases for a particular repo, optionally filtered by release | ||
* and/or based on inclusion of a particular asset. | ||
* | ||
* @param user the name of the user or organization that owns the repo | ||
* @param repo the name of the repository that you want to list releases of | ||
* @param outputDir the relative path to a directory to write the downloaded releases to | ||
* @param filterRelease the release filter function | ||
* @param filterAsset the asset filter function | ||
* @param unzip pass true if you want it the result to be unzipped as well. | ||
*/ | ||
function downloadReleases(user, repo, outputDir, filterRelease, filterAsset, unzip) { | ||
if (filterRelease === void 0) { filterRelease = pass; } | ||
if (filterAsset === void 0) { filterAsset = pass; } | ||
if (unzip === void 0) { unzip = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var releases, bigResult; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, getFilteredReleases(user, repo, filterRelease, filterAsset)]; | ||
case 1: | ||
releases = _a.sent(); | ||
return [4 /*yield*/, Promise.all(releases.map(function (release) { return __awaiter(_this, void 0, void 0, function () { | ||
var promises, result; | ||
@@ -90,0 +141,0 @@ var _this = this; |
{ | ||
"name": "@etclabscore/dl-github-releases", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -23,4 +23,9 @@ "main": "build/index.js", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "jest" | ||
"build": "npm run build:code && npm run build:docs", | ||
"build:docs": "typedoc", | ||
"build:code": "tsc", | ||
"test": "npm run test:lint && npm run test:unit", | ||
"test:lint": "tslint -c tslint.json 'src/**/*.ts' --fix", | ||
"test:unit": "jest --coverage", | ||
"watch:test": "jest --watch" | ||
}, | ||
@@ -36,2 +41,8 @@ "author": "ETCLabs Core", | ||
"devDependencies": { | ||
"@qiwi/semantic-release-gh-pages-plugin": "^1.9.1", | ||
"@semantic-release/changelog": "^3.0.2", | ||
"@semantic-release/commit-analyzer": "^6.1.0", | ||
"@semantic-release/git": "^7.0.8", | ||
"@semantic-release/github": "^5.2.10", | ||
"@semantic-release/release-notes-generator": "^7.1.4", | ||
"@types/extract-zip": "^1.6.2", | ||
@@ -45,5 +56,8 @@ "@types/fs-extra": "^5.0.5", | ||
"jest": "^24.7.1", | ||
"semantic-release": "^15.13.12", | ||
"ts-jest": "^24.0.2", | ||
"tslint": "^5.17.0", | ||
"typedoc": "^0.14.2", | ||
"typescript": "^3.4.1" | ||
} | ||
} |
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
27904
14
448
19