mirror of
https://github.com/ivabus/gui
synced 2025-04-23 22:17:18 +03:00
cleanup
This commit is contained in:
parent
d396c8673a
commit
99ba0a5540
1 changed files with 2 additions and 13 deletions
|
@ -2,25 +2,14 @@ import axios from 'axios';
|
|||
import type { Contributor } from '@tea/ui/types';
|
||||
const yaml = window.require('yaml');
|
||||
|
||||
export async function getGithubOwnerRepo(
|
||||
pkgYamlUrl: string
|
||||
): Promise<{ owner: string; repo: string }> {
|
||||
let owner = '';
|
||||
let repo = '';
|
||||
|
||||
export async function getPackageYaml(pkgYamlUrl: string) {
|
||||
const url = pkgYamlUrl.replace('/github.com', '/raw.githubusercontent.com').replace('/blob', '');
|
||||
|
||||
const { data: rawYaml } = await axios.get(url);
|
||||
|
||||
const data = await yaml.parse(rawYaml);
|
||||
if (data?.versions?.github) {
|
||||
[owner, repo] = data.versions.github.split('/').filter((b: string) => b);
|
||||
}
|
||||
|
||||
return {
|
||||
owner,
|
||||
repo
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function getReadme(owner: string, repo: string): Promise<string> {
|
||||
|
|
Loading…
Reference in a new issue