woops
This commit is contained in:
parent
a7457513d7
commit
78cc819029
4 changed files with 2 additions and 127 deletions
|
|
@ -1,65 +0,0 @@
|
||||||
version: '3'
|
|
||||||
|
|
||||||
interval: 500ms
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
template:
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
desc: Generate template from source code
|
|
||||||
cmds:
|
|
||||||
- go run github.com/maddalax/htmgo/framework/tooling/downloadtemplate@latest -out my-app
|
|
||||||
- echo "Template generated successfully to ./my-app"
|
|
||||||
|
|
||||||
setup:
|
|
||||||
deps: [copy-framework-assets, ast]
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
desc: Setup the project
|
|
||||||
cmds:
|
|
||||||
- go mod download
|
|
||||||
- go mod tidy
|
|
||||||
|
|
||||||
run:
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
desc: Run the project
|
|
||||||
cmds:
|
|
||||||
- task: setup
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
- go run .
|
|
||||||
|
|
||||||
build:
|
|
||||||
deps: [setup]
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
desc: Build the project
|
|
||||||
cmds:
|
|
||||||
- rm -rf ./dist
|
|
||||||
- mkdir -p ./dist/assets/dist
|
|
||||||
- cp -r ./assets/dist/* ./dist/assets/dist/
|
|
||||||
- go build -o "./dist" .
|
|
||||||
- echo "Build successful"
|
|
||||||
|
|
||||||
copy-framework-assets:
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
desc: Copy framework assets
|
|
||||||
cmds:
|
|
||||||
- go run github.com/maddalax/htmgo/framework/tooling/copyassets@latest
|
|
||||||
|
|
||||||
ast:
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
desc: Generate AST from source code
|
|
||||||
generates:
|
|
||||||
- '**/generated.go'
|
|
||||||
cmds:
|
|
||||||
- go run github.com/maddalax/htmgo/framework/tooling/astgen@latest
|
|
||||||
|
|
||||||
ast-watch:
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
desc: Generate AST from source code and watch for changes
|
|
||||||
watch: true
|
|
||||||
generates:
|
|
||||||
- '**/generated.go'
|
|
||||||
sources:
|
|
||||||
- '**/*.go'
|
|
||||||
cmds:
|
|
||||||
- task: ast
|
|
||||||
dir: '{{.USER_WORKING_DIR}}'
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
module github.com/maddalax/htmgo/framework/tooling/htmgo
|
|
||||||
|
|
||||||
go 1.23.0
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
_ "embed"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:embed Taskfile.yml
|
|
||||||
var taskFile string
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
taskFlag := flag.String("task", "", "Specify the task to run (e.g., build, setup). Type -task list to see the list of tasks to run.")
|
|
||||||
|
|
||||||
// Parse the command-line flags
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
install := exec.Command("go", "install", "github.com/go-task/task/v3/cmd/task@latest")
|
|
||||||
install.Stdout = os.Stdout
|
|
||||||
install.Stderr = os.Stderr
|
|
||||||
err := install.Run()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("Error installing task: %v\n", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
temp, err := os.CreateTemp("", "Taskfile.yml")
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("Error creating temporary file: %v\n", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
os.WriteFile(temp.Name(), []byte(taskFile), 0644)
|
|
||||||
|
|
||||||
if *taskFlag == "" {
|
|
||||||
fmt.Println("Please specify a task to run using the -task flag")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if *taskFlag == "list" {
|
|
||||||
*taskFlag = "--list"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define the command and arguments
|
|
||||||
cmd := exec.Command("task", "-t", temp.Name(), *taskFlag)
|
|
||||||
// Set the standard output and error to be the same as the Go program
|
|
||||||
cmd.Stdout = os.Stdout
|
|
||||||
cmd.Stderr = os.Stderr
|
|
||||||
// Run the command
|
|
||||||
err = cmd.Run()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("Error running task command: %v\n", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
3
setup.md
3
setup.md
|
|
@ -1 +1,2 @@
|
||||||
go run github.com/maddalax/htmgo/framework/tooling/htmgo@latest -task template
|
go install github.com/maddalax/htmgo/framework/tooling/htmgo@latest
|
||||||
|
go run htmgo -task template
|
||||||
Loading…
Reference in a new issue