UNPKG

github-automated-repos

Version:

The library, ReactJS, that gives you the power to control / automate your GitHub data, your projects on the portfolio / website, in your own GitHub in one place!

33 lines (32 loc) 1.86 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { fetchGitHubAPI } from '../api/fetchGitHubAPI'; import { _handleBanner } from './_handleBanner'; /** * @param {string} usernameGitHub - Insert your GitHub username. See in your GitHub Ex.: https://github.com/USERNAME * @param {string} keyWordDeploy - Insert a keyword chosen by you. - This key is responsible for managing your projects on GitHub in topics field. See in : https://github.com/DIGOARTHUR/github-automated-repos. */ export const fetchRepositories = (usernameGitHub, keyWordDeploy) => __awaiter(void 0, void 0, void 0, function* () { const jsonData = yield fetchGitHubAPI(usernameGitHub); const datafilter = jsonData.filter((item) => item.topics.includes(keyWordDeploy)); const repositories = yield Promise.all(datafilter.map((item) => __awaiter(void 0, void 0, void 0, function* () { const banner = yield _handleBanner(usernameGitHub, item.name); return { id: item.id, name: item.name, html_url: item.html_url, description: item.description, topics: item.topics, homepage: item.homepage, banner, }; }))); return repositories; });