repair and uninstall are cli scripts

Rationale: pantries decide how they build and install things themselves, but after installation that's tea/cli’s domain
This commit is contained in:
Max Howell 2022-09-18 13:08:21 -04:00
parent 9ef68310c9
commit ea5805d4b3
2 changed files with 0 additions and 51 deletions

View file

@ -1,24 +0,0 @@
#!/usr/bin/env -S tea -E
/*
---
args:
- deno
- run
- --allow-net
- --allow-env=TEA_PREFIX,VERBOSE,DEBUG,MAGIC,GITHUB_ACTIONS,JSON
- --allow-read={{ tea.prefix }}
- --allow-write={{ tea.prefix }}
- --allow-run # uses `/bin/ln`
- --import-map={{ srcroot }}/import-map.json
---
*/
import repairLinks from "prefab/repair-links.ts"
import useFlags from "hooks/useFlags.ts"
useFlags()
for (const project of Deno.args) {
await repairLinks(project)
}

View file

@ -1,27 +0,0 @@
#!/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
}