tea/cli handles installation

This commit is contained in:
Max Howell 2022-09-19 13:44:59 -04:00
parent 55eb7dc5e4
commit 232d693f44
2 changed files with 0 additions and 55 deletions

View file

@ -1,20 +0,0 @@
#!/usr/bin/env -S tea -E
_="
---
args: /bin/sh
---
"
ROOTS=$(ls /opt/tea.xyz/var/pantry/projects)
for x in $ROOTS
do
if [ "X$x" = "X" ]
then
continue
fi
rm -rf /opt/"$x"
done
rm /opt/tea.xyz/var/www/*.tar.?z

View file

@ -1,35 +0,0 @@
#!/usr/bin/env -S tea -E
// returns all pantry entries as `[{ name, path }]`
/*---
args:
- deno
- run
- --allow-env
- --allow-read
- --allow-write
- --import-map={{ srcroot }}/import-map.json
- --allow-net
- --allow-run
---*/
import { lvl1 as link } from "prefab/link.ts"
import install from "prefab/install.ts"
import { parsePackageRequirement } from "types"
import resolve from "prefab/resolve.ts"
import useFlags from "hooks/useFlags.ts"
useFlags()
const pkgs = Deno.args.map(project => {
const match = project.match(/projects\/(.+)\/package.yml/)
return match ? match[1] : project
}).map(parsePackageRequirement)
// resolve and install precise versions that are available in available inventories
for await (const pkg of await resolve(pkgs)) {
console.log({ installing: pkg.project })
const installation = install(pkg)
await link(installation)
}