forked from defunkt/toes
Remove bare git repo on app deletion
This commit is contained in:
parent
2046af1407
commit
be7a7bd35b
|
|
@ -2,10 +2,11 @@ import { APPS_DIR, allApps, emit, registerApp, removeApp, restartApp, startApp }
|
|||
import { computeHash, generateManifest } from '../sync'
|
||||
import { loadGitignore } from '@gitignore'
|
||||
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync, unlinkSync, watch, writeFileSync } from 'fs'
|
||||
import { dirname, join } from 'path'
|
||||
import { dirname, join, resolve } from 'path'
|
||||
import { Hype } from '@because/hype'
|
||||
|
||||
const MAX_VERSIONS = 5
|
||||
const REPOS_DIR = resolve(process.env.DATA_DIR ?? '.', 'repos')
|
||||
|
||||
interface FileChangeEvent {
|
||||
hash?: string
|
||||
|
|
@ -210,6 +211,11 @@ router.delete('/apps/:app', c => {
|
|||
|
||||
removeApp(appName)
|
||||
rmSync(appPath, { recursive: true })
|
||||
|
||||
// Remove bare git repo if one exists
|
||||
const repoPath = join(REPOS_DIR, `${appName}.git`)
|
||||
if (existsSync(repoPath)) rmSync(repoPath, { recursive: true })
|
||||
|
||||
return c.json({ ok: true })
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user