diff options
Diffstat (limited to 'cmd/yeet/main.go')
| -rw-r--r-- | cmd/yeet/main.go | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/cmd/yeet/main.go b/cmd/yeet/main.go index 2ad7985..6eca911 100644 --- a/cmd/yeet/main.go +++ b/cmd/yeet/main.go @@ -10,13 +10,13 @@ import ( "os/exec" "path/filepath" "runtime" - "runtime/debug" "strings" "al.essio.dev/pkg/shellescape" "github.com/dop251/goja" "within.website/x/cmd/yeet/internal/mkdeb" "within.website/x/cmd/yeet/internal/mkrpm" + "within.website/x/cmd/yeet/internal/mktarball" "within.website/x/cmd/yeet/internal/pkgmeta" "within.website/x/internal" "within.website/x/internal/appsluggr" @@ -89,10 +89,6 @@ func flydeploy() { runcmd(*flyctl, "deploy", "--now") } -func nixbuild(target string) { - runcmd("nix", "build", target) -} - func slugbuild(bin string, extraFiles map[string]string) string { result := fmt.Sprintf("%s-%s.tar.gz", bin, yeet.DateTag) appsluggr.Must(bin, result, extraFiles) @@ -171,7 +167,6 @@ func main() { defer func() { if r := recover(); r != nil { slog.Error("error in JS", "err", r) - debug.PrintStack() } }() @@ -200,6 +195,14 @@ func main() { "push": dockerpush, }) + vm.Set("file", map[string]any{ + "install": func(src, dst string) { + if err := mktarball.Copy(src, dst); err != nil { + panic(err) + } + }, + }) + vm.Set("fly", map[string]any{ "deploy": flydeploy, }) @@ -239,6 +242,16 @@ func main() { "push": slugpush, }) + vm.Set("tarball", map[string]any{ + "build": func(p pkgmeta.Package) string { + foutpath, err := mktarball.Build(p) + if err != nil { + panic(err) + } + return foutpath + }, + }) + vm.Set("yeet", map[string]any{ "cwd": yeet.WD, "datetag": yeet.DateTag, |
