pantry/scripts/uninstall.ts

28 lines
666 B
TypeScript
Raw Normal View History

2022-09-08 23:40:35 +03:00
#!/usr/bin/env -S tea -E
/*
---
args:
- deno
- run
- --allow-net
- --allow-read
- --allow-write={{ tea.prefix }}
- --import-map={{ srcroot }}/import-map.json
---
*/
import { parsePackageRequirement } from "types"
import useCellar from "hooks/useCellar.ts"
import repairLinks from "prefab/repair-links.ts"
const pkgs = Deno.args.map(parsePackageRequirement); console.verbose({ received: pkgs })
const { resolve } = useCellar()
for (const pkg of pkgs) {
console.info({ uninstalling: pkg })
const installation = await resolve(pkg)
installation.path.rm({ recursive: true })
await repairLinks(pkg.project) //FIXME this is overkill, be precise
}