๐Ÿ“ฆ CLI for setting up a Go WebAssembly frontend app

Overview

go-web-app cover

GitHub code size in bytes Go Report Card Codacy grade

Simple CLI for setting up Go WebAssembly frontend app.

What's included

  • ๐Ÿ› ๏ธ Dev Server with live reload
  • ๐Ÿ—œ๏ธ TinyGo for small WebAssembly output
  • โžก Git setup with files (such as README.md)
  • ๐Ÿฉน Glue files (index.html + wasm_exec.js)

Requirements

  • Go 1.12+
  • Browser that supports WebAssembly
  • lld (LLVM linker)

Install

go get github.com/talentlessguy/go-web-app

Then use as go-web-app.

CLI Reference

go-web-app init

Initialize a project in a picked directory.

Project tree

out.wasm is generated when building. Other files are automatically added.

โ”œโ”€โ”€ src
โ”‚   โ””โ”€โ”€ main.go
โ”œโ”€โ”€ build
โ”‚   โ””โ”€โ”€ out.wasm
โ”œโ”€โ”€ go.mod
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ wasm_exec.js

go-web-app dev --port

Builds the project on first run and launches a development server with specified port.

Default port is 8080.

After launching a server, you should go to http://localhost:

Every time you change a file in src dev server automatically compiles and updates the page.

go-web-app build

Compiles go code to WebAssembly. Compiled out.wasm file could be found in build folder.

Everything in src compiles to build, every go file.

After build, binary size is shown

You might also like...
A CLI application that allows you to run a complete ToDo app from your terminal application

todo-cli This is a CLI application that allows you to run a complete ToDo app from your terminal application. As a user you can: Create a list of todo

Simple CLI App for creating recurring google calendar events

Kronus A CLI App to help you stay in touch with the people that matter by leveraging the google calender API. You can create touchbase events for cont

This is a Go Cli app that receives an string path to a log file, and based on it generates  and prints in console an encoded polyline with the locations found in the log file.
This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an encoded polyline with the locations found in the log file.

GEOENCODE GO CLI APP DESCRIPTION This is a Go Cli app that receives an string path to a log file, and based on it generates and prints in console an e

simple cli app for search and watch anime

simple terminal app for search and watch movie or anime

ntest is a cross-platform cli app that runs multiple tests against any address.
ntest is a cross-platform cli app that runs multiple tests against any address.

ntest ntest is a cross-platform cli app that runs multiple tests against any address. About ntest Having the ability to run common tests against any d

A simple CLI app to update dynamic DNS settings for your CloudFlare account

Cloudflare Dynamic DNS Updater (Go) written by Darren Rambaud Why? A simple CLI app to update dynamic DNS settings for your CloudFlare account. Useful

A simple CLI app to take notes daily on markdown file
A simple CLI app to take notes daily on markdown file

A simple CLI app to take notes daily on markdown file

A cli client-server app with cobra
A cli client-server app with cobra

cli-client-server-calculator a cli client-server app with cobra overview this project is a cli client-server app in which client gives a bunch of numb

Go-ticket-booking-app - Simple CLI application which books tickets for a Go conference made to learn the fundamentals of Go programming language.

go-ticket-booking-app Simple CLI application which books ticket for a Go conference made to learn the fundamentals of Go programming language. Gorouti

Comments
  • [Bug] go get github.com/talentlessguy/go-web-app fail to build

    [Bug] go get github.com/talentlessguy/go-web-app fail to build

    When doing go get github.com/talentlessguy/go-web-app it fails to build

    go get github.com/talentlessguy/go-web-app
    # github.com/talentlessguy/go-web-app
    github.com/talentlessguy/go-web-app/main.go:15:5: app.Author undefined (type *cli.App has no field or method Author)
    github.com/talentlessguy/go-web-app/main.go:20:15: cannot use []cli.Command literal (type []cli.Command) as type []*cli.Command in assignment
    github.com/talentlessguy/go-web-app/main.go:24:4: cannot use InitWebApp (type func(*cli.Context)) as type cli.ActionFunc in field value
    github.com/talentlessguy/go-web-app/main.go:29:4: cannot use CompileToWASMCLI (type func(*cli.Context)) as type cli.ActionFunc in field value
    github.com/talentlessguy/go-web-app/main.go:31:19: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
    	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
    github.com/talentlessguy/go-web-app/main.go:41:4: cannot use RunDevServer (type func(*cli.Context)) as type cli.ActionFunc in field value
    github.com/talentlessguy/go-web-app/main.go:43:19: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
    	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
    

    How to fix (optional)

    I think it has to do with the new versions of github.com/urfave/cli

    Go version

    go version go1.15.6 darwin/amd64

    go env

    GO111MODULE=""
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="/Users/pedro/Library/Caches/go-build"
    GOENV="/Users/pedro/Library/Application Support/go/env"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="darwin"
    GOINSECURE=""
    GOMODCACHE="/Users/pedro/go/pkg/mod"
    GONOPROXY=""
    GONOSUMDB=""
    GOOS="darwin"
    GOPATH="/Users/pedro/go"
    GOPRIVATE=""
    GOPROXY="https://proxy.golang.org,direct"
    GOROOT="/usr/local/Cellar/go/1.15.6/libexec"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/usr/local/Cellar/go/1.15.6/libexec/pkg/tool/darwin_amd64"
    GCCGO="gccgo"
    AR="ar"
    CC="clang"
    CXX="clang++"
    CGO_ENABLED="1"
    GOMOD=""
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0y/xvz2rfcd1znf4myy_znggft00000gn/T/go-build070457126=/tmp/go-build -gno-record-gcc-switches -fno-common"
    
    bug 
    opened by pmilanez 2
  • Module path should be

    Module path should be "github.com/talentlessguy/go-web-app", not "create-go-web-app"

    Background

    Module path is inconsistent with go import path. GO111MODULE=on, run go get github.com/talentlessguy/go-web-app:

    go: downloading github.com/talentlessguy/go-web-app v0.0.0-20200622190614-48b1d7b20b5e
    go: github.com/talentlessguy/go-web-app upgrade => v0.0.0-20200622190614-48b1d7b20b5e
    go get: github.com/talentlessguy/[email protected]: parsing go.mod:
            module declares its path as: create-go-web-app
                    but was required as: github.com/talentlessguy/go-web-app 
    

    Solution

    Fix the module path:

    1. Rename the module path to "github.com/talentlessguy/go-web-app": https://github.com/mikezss/skl-go/blob/master/go.mod#L1
    module github.com/talentlessguy/go-web-app
    go 1.12
    require (
    	โ€ฆ
    ) 
    
    1. Warning the users not to use the module, get "github.com/talentlessguy/go-web-app" in GOPATH mode.
    bug 
    opened by KateGo520 2
  • [Bug] WebSockets only work on port 8080

    [Bug] WebSockets only work on port 8080

    The bug

    For now, index.html's script initiates WebSockets on ws://localhost:8080/reload but in theory it must be able to use any port. I guess it can be achieved with html/template, something like {{ .Port }}

    bug 
    opened by talentlessguy 0
  • Different ways of compiling Go

    Different ways of compiling Go

    Problem

    Due to some issues in TinyGo I can't only use it because it lacks syscall/js support for all the DOM. So we need both standard compiler and tinygo as options.

    Solution

    Add flags to gwa build

    gwa build --native
    

    Regular compiler will be used when native flag is passed. Also might use upx for compressing binaries.

    enhancement help wanted good first issue 
    opened by talentlessguy 3
Releases(v0.0.9)
Owner
v 1 r t l
17 yo nerd / nightwalker
v 1 r t l
CLI Program for setting League Of Legends runes automatically. Written in Golang.

SimplyRunes CLI Program for setting League Of Legends runes automatically. Written in Golang. I made this, because I was tired of other apps like Poro

Natan Gardocki 0 Feb 21, 2022
โœจ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

โœจ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

Create Go App 1.8k Dec 31, 2022
CLI and web app to convert HTML markup to go-app.dev's syntax.

HTML to go-app Converter CLI and web app to convert HTML markup to go-app.dev's syntax. Installation CLI Static binaries are also available on GitHub

Felix Pojtinger 12 Dec 18, 2022
Test-app-url-shortner - A sample url shortener app to test Keploy integration capabilities

test-app-url-shortner A sample url shortener app to test Keploy integration capa

null 1 Jan 23, 2022
Go-cent-app - CENT.APP GO Package

CENT.APP - GO Package Official documentation - https://cent.app/en/merchant/api

Aleksandr Kalinkin 3 Dec 20, 2022
CLI - A package for building command line app with go

Command line interface Screenshot Key features Lightweight and easy to use. Defines flag by tag, e.g. flag name(short or/and long), description, defau

็Ž‹ไป•ๆ™‹ 678 Dec 23, 2022
Cli app to quicky add gitignore files to your current environment

Gitignorer Cli app to quickly add gitignore files to your current environment/projects Usage Make sure golang s installed on your machine. After that

Rubin Bhandari 10 Jul 18, 2022
Highly customizable and lightweight Go CLI app framework ๐Ÿ‘Œ

Nice ?? Nice is a highly customizable and lightweight framework for crafting CLI apps. Nice respects idiomatic Go code and focuses to be clear, effici

Aleksandr Krivoshchekov 203 Dec 30, 2022
cross-platform, cli app to perform various operations on string

sttr is command line software that allows you to quickly run various transformation operations on the string.

Abhimanyu Sharma 632 Dec 30, 2022