something something git

This commit is contained in:
peter
2019-08-20 00:34:24 +02:00
parent 940f2f439d
commit 79c832e463
5 changed files with 202 additions and 52 deletions
+3 -1
View File
@@ -11,7 +11,7 @@ const rmrf = (path:string, options = {}) => {
return new Promise((acc, _) => rimraf(path, options, acc))
}
type RepoFolderStatus = {
export type RepoFolderStatus = {
exists: boolean
empty: boolean
currentTag?: string
@@ -53,6 +53,8 @@ export class GitUpdater{
}
async cloneRepo(from:string, force:boolean = false):Promise<RepoFolderStatus> {
if(this.folderPath === "." && force)
throw new Error("refusing to `rm -rf .`: \ncloneRepo(from: "+from+", force: "+force+")")
if(force){
await rmrf(this.folderPath)
await fs.mkdir(this.folderPath, { recursive: true });