support other repo

This commit is contained in:
Opportunity
2020-06-30 01:54:04 +08:00
Unverified
parent 2feaa3232f
commit 48f33e8789
66 changed files with 3280 additions and 1532 deletions
+8
View File
@@ -7,6 +7,13 @@ export function Sha(sha: string): Sha {
return sha as Sha;
}
export type Repo = Opaque<string, 'repo'>;
export function Repo(repo: string): Repo {
repo = repo.trim();
if (!/^([^/#]+\/[^/#]+)$/g.test(repo)) throw new Error(`Invalid repo value ${repo}`);
return repo as Repo;
}
export type RefDic = {
/** branches */
heads: Record<string, Sha>;
@@ -30,4 +37,5 @@ export interface Version {
version: string;
sha: Sha;
type: keyof RefDic | 'sha';
repo: Repo;
}