gotrino-make
Package gotrino-make/cmd/gotrino-make contains a program to build or serve with hot deployment a gotrino wasm project.
usage and example
GO111MODULE=off GOPROXY=direct go get -u github.com/golangee/gotrino-make/cmd/gotrino-make
mkdir -p ~/tmp/gotrino-test/cmd/wasm
cd ~/tmp/gotrino-test
go mod init mycompany.com/myproject
cat > cmd/wasm/main.go << EOL
package main
import (
"github.com/golangee/dom"
"github.com/golangee/gotrino"
"github.com/golangee/gotrino-tailwind/button"
)
func main() {
// start your actual application, better refactor it into a call to internal/app
run()
// keep wasm alive, e.g. for click listeners
select {}
}
func run(){
// show error, if run fails with panic
defer dom.GlobalPanicHandler()
// render some component or html
gotrino.RenderBody(button.NewTextButton("hello world",func(){
panic("not yet implemented")
}))
}
EOL
gofmt -w cmd/wasm/main.go
gotrino-make -dir=./dist build
gotrino-make -host=0.0.0.0 -www=. serve
gotrino-make options
gotrino-make -h
Usage gotrino-make:
-debug
enable debug logging output for gotrino-make.
-deploy-dst string
the remote folder to upload (default "/")
-deploy-host string
the host to deploy to
-deploy-password string
the host password to deploy to
-deploy-port int
the remote port (e.g. ftp) (default 21)
-deploy-skip-verify
accept invalid certificates
-deploy-src string
the local folder to upload
-deploy-user string
the host user to deploy to
-dir string
the target output build directory. If empty a temporary folder is picked automatically.
-extra string
filename to a local json file, which contains extra BuildInfo values. Accessible in templates by {{.Extra}}
-forceRefresh
if set to true, all file hashes are always recalculated for each build instead of relying on ModTime.
-generate
if set to true, 'go generate' is invoked everytime before building.
-host string
the host to bind on. (default "localhost")
-port int
the port to bind to for the serve mode. (default 8080)
-templatePatterns string
file extensions which should be processed as text/template with BuildInfo. (default ".gohtml,.gocss,.gojs,.gojson,.goxml")
-www string
the directory which contains the go wasm module to build.
BuildInfo fields for templating
type BuildInfo struct {
Time time.Time
Version string
CompileError error
HotReload bool
Wasm bool
Commit string
Host string
Compiler string
Extra interface{}
}
simple ftp deployment
To make things easier and have a "just deploy it" experience for your simple web space provider,
there is a trivial ftp implementation. Example:
gotrino-make -deploy-host=$FTP_HOST -deploy-user=$FTP_USER -deploy-password=$FTP_PASSWORD -deploy-src=<your www path> deploy-ftp