Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/golangee/gotrino-make

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/golangee/gotrino-make

  • v0.0.0-20201221125800-3c1f4a53551f
  • Source
  • Go
  • Socket score

Version published
Created
Source

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

# install into ~/go/bin
GO111MODULE=off GOPROXY=direct go get -u github.com/golangee/gotrino-make/cmd/gotrino-make

# create a new wasm project
mkdir -p ~/tmp/gotrino-test/cmd/wasm
cd ~/tmp/gotrino-test
go mod init mycompany.com/myproject

# by convention, there must be a main package in cmd/wasm as an entry point
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

# make nice
gofmt -w cmd/wasm/main.go

# build for productive deployment
gotrino-make -dir=./dist build

# serve and rebuild automatically. Use 0.0.0.0 to be able to connect with your smartphone (security concern). 
# Now change your file and note that the browser will automatically reload the page.
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

// BuildInfo provides some basic information about a gotrino build.
type BuildInfo struct {
    // Time of this build.
    Time time.Time
    // Version contains a hash or something else which uniquely identifies this build.
    Version string
    // CompileError is nil or contains a compile error.
    CompileError error
    // HotReload is true, if the server should be polled at /api/v1/poll/version.
    HotReload bool
    // Wasm is true, if the web assembly (app.wasm) is available.
    Wasm bool
    // Commit may be empty, if the project is not contained in a git repository.
    Commit string
    // Host name.
    Host string
    // Compiler denotes the compiler which has created the wasm build.
    Compiler string
    // Extra may be nil or injected by user.
    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

FAQs

Package last updated on 21 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc