- tools/server/: Node.js dev server (Express + WebSocket + fs.watch) Watches themes/ for .tmpl changes, rebuilds via Go preview command, applies Juice CSS inlining for email client compatibility, pushes live reload to browser via WebSocket. - tools/cli/dev.go: 'go run . dev' subcommand — starts Node.js server with automatic npm install, initial preview generation, and Ctrl+C graceful shutdown. - tools/tools.go: register dev command in CLI app. - .gitignore: add node_modules exclusion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
31 lines
563 B
Go
31 lines
563 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
cmds "gitea-mail-templates/tools/cli"
|
|
)
|
|
|
|
func main() {
|
|
app := &cli.App{
|
|
Name: "tools",
|
|
Usage: "Gitea Mail Templates CLI — manage and preview email template themes",
|
|
UsageText: "tools <command> [args...] [--flags]",
|
|
Commands: []*cli.Command{
|
|
cmds.ListCommand(),
|
|
cmds.CreateCommand(),
|
|
cmds.DeleteCommand(),
|
|
cmds.PreviewCommand(),
|
|
cmds.DevCommand(),
|
|
},
|
|
}
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|