WIP update deps, sql builder instead of jet

This commit is contained in:
2025-03-10 10:29:18 -04:00
parent cb3b1a429c
commit 13747c2118
87 changed files with 5208 additions and 2523 deletions

View File

@@ -1,52 +0,0 @@
package main
import (
"fmt"
"os"
"os/exec"
"runtime"
)
func compileJet() {
fmt.Printf("Compiling Jet generator")
os.Setenv("CGO_ENABLED", "1")
cmd := exec.Command("go", "build", "./cmd/jet")
cmd.Dir = "./tools/jet-2.12.0"
handleCmdOutput(cmd.CombinedOutput())
}
func generateJetModels() {
bin := ""
jetdir := ".jet"
if runtime.GOOS == "windows" {
bin = "./tools/jet-2.12.0/jet.exe"
} else {
bin = "./tools/jet-2.12.0/jet"
}
os.RemoveAll(jetdir)
// compile bin if not exists
if _, err := os.Stat(bin); err != nil {
compileJet()
}
fmt.Printf("Generating SQL models (jet)")
if _, err := os.Stat("passwords.db"); err != nil {
printStatus(false)
fmt.Println("\n" + err.Error())
os.Exit(1)
}
databaseType := "sqlite"
cmd := exec.Command(bin, "-source="+databaseType, "-dsn=file:passwords.db", "-schema=maxwarden", "-path="+jetdir)
handleCmdOutput(cmd.CombinedOutput())
printStatus(true)
}

View File

@@ -4,7 +4,6 @@ import (
"flag"
"fmt"
"os"
"os/exec"
)
var envtype int // set by user with cli flag
@@ -43,10 +42,6 @@ func main() {
for _, arg := range args {
switch arg {
case "build-all":
preBuild()
build()
goto End
case "build":
preBuild()
goto End
@@ -86,26 +81,4 @@ func preBuild() {
// code generation
generateInlineStyles()
generateDebugConfig()
generateJetModels()
}
func build() {
compileServer()
}
func compileServer() {
var out []byte
var err error
fmt.Printf("Compiling Server Binary")
if envtype == ENVIRONMENT_DEV {
// include extra flags for the GC
out, err = exec.Command("go", "build", "-gcflags=all=-N -l", "./cmd/server").CombinedOutput()
} else {
out, err = exec.Command("go", "build", "./cmd/server").CombinedOutput()
}
handleCmdOutput(out, err)
printStatus(true)
}
}