cleanup sneakers too
This commit is contained in:
parent
a67b04ba51
commit
0f17da319a
|
|
@ -3,18 +3,20 @@
|
||||||
import { rmdirSync } from "fs"
|
import { rmdirSync } from "fs"
|
||||||
import { DEFAULT_PROJECT } from "@/config"
|
import { DEFAULT_PROJECT } from "@/config"
|
||||||
import { projectDir, projects, projectName } from "@/project"
|
import { projectDir, projects, projectName } from "@/project"
|
||||||
|
import { disconnectSneaker } from "@/sneaker"
|
||||||
import load from "./load"
|
import load from "./load"
|
||||||
|
|
||||||
export default function (project: string, confirm = false) {
|
export default async function (project: string, confirm = false) {
|
||||||
if (!projects().includes(project)) throw `no ${project} project`
|
if (!projects().includes(project)) throw `no ${project} project`
|
||||||
if (project === DEFAULT_PROJECT) throw `can't delete ${DEFAULT_PROJECT} project`
|
if (project === DEFAULT_PROJECT) throw `can't delete ${DEFAULT_PROJECT} project`
|
||||||
if (!confirm) throw `> Are you POSITIVE?\n> Run again with 'true' at the end:\n\n$ rmproject ${project} true`
|
if (!confirm) throw `> Are you POSITIVE?\n> Run again with 'true' at the end:\n\n$ rmproject ${project} true`
|
||||||
|
|
||||||
const isCurrent = projectName() === project
|
const isCurrent = projectName() === project
|
||||||
|
if (isCurrent) load("root")
|
||||||
|
|
||||||
|
await disconnectSneaker(project)
|
||||||
|
|
||||||
rmdirSync(projectDir(project), { recursive: true })
|
rmdirSync(projectDir(project), { recursive: true })
|
||||||
|
|
||||||
if (isCurrent)
|
return `${project} deleted`
|
||||||
|
|
||||||
return `${project} deleted`
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user