@qiwi/repocrawler-common v1.1.0
@qiwi/repocrawler-common
Common types & helper functions
All crawlers implement TRepoCrawler
interface
TRepoCrawler
getCommit(owner: string, repo: string, ref: string): Promise<TCommitInfo>
Get commit by ref
from owner
/repo
repository.
getRawContent(owner: string, repo: string, path: string): Promise
Get file path
from owner
/repo
repository.
fetchRepoInfo(opts: { out: string, paths?: string[], orgs?: Array }): Promise<PromiseSettledResult[]>
Fetch files for all repositories by list of organizations/owners. Output is a separate json-file for each repository.
out
- path to directory to save output files;paths
- paths of files to fetch, default ispackage.json
,yarn.lock
,package-lock.json
,npm-shrinkwrap.json
;orgs
- list of organizations/owners, defaults to all.
If paths
is not specified, output file format is TRepoCrawlerReportResultItem, this can be used as input for @qiwi/repocrawler-reporters.
Otherwise output file format is TRepoCrawlerResultItem.
getRepoFiles(repo: TRepo, paths: string[]): Promise<TFile[]>
Fetch files of repo repo.org
/repo.repo
by paths
.
getInfoByRepos(repo: TRepo, paths: string[])): Promise<TRepoCrawlerResultItem[]>
Fetch files and last commits of given repos by paths
getReportInfoByRepos(repo: TRepo): Promise<TRepoCrawlerReportResultItem[]>
Get package.json
, yarn.lock
, package-lock.json
, npm-shrinkwrap.json
and last commits if given repos. Json-files are parsed.
Output files can be used as input for @qiwi/repocrawler-reporters
commonCrawlerMethodsFactory(base: TBaseCrawler, opts: { name: string, debug?: boolean }, logger: ILogger): TCommonCrawler
Returns object with common crawler methods.