docs & cleaning

Michael Muré created

Change summary

bug/bug.go                         |  1 
cache/doc.go                       |  3 ++
commands/root.go                   |  1 
graphql/connections/connections.go |  1 
graphql/handler.go                 |  2 +
graphql/models/models.go           |  1 
graphql/relay.go                   | 37 --------------------------------
graphql/resolvers/root.go          |  1 
input/input.go                     |  4 ++
operations/operations.go           |  3 ++
termui/termui.go                   |  1 
webui/Readme.md                    | 16 +++++++++++++
12 files changed, 33 insertions(+), 38 deletions(-)

Detailed changes

bug/bug.go 🔗

@@ -1,3 +1,4 @@
+// Package bug contains the bug data model and low-level related functions
 package bug
 
 import (

cache/doc.go 🔗

@@ -0,0 +1,3 @@
+// Package cache contains a caching layer on top of the low-level bug
+// functions to provide efficient querying, filtering, sorting.
+package cache

commands/root.go 🔗

@@ -1,3 +1,4 @@
+// Package commands contains the CLI commands
 package commands
 
 import (

graphql/connections/connections.go 🔗

@@ -2,6 +2,7 @@
 //go:generate genny -in=connection_template.go -out=gen_operation.go gen "NodeType=bug.Operation EdgeType=models.OperationEdge ConnectionType=models.OperationConnection"
 //go:generate genny -in=connection_template.go -out=gen_comment.go gen "NodeType=bug.Comment EdgeType=models.CommentEdge ConnectionType=models.CommentConnection"
 
+// Package connections implement a generic GraphQL relay connection
 package connections
 
 import (

graphql/handler.go 🔗

@@ -1,5 +1,6 @@
 //go:generate go run gen_graphql.go
 
+// Package graphql contains the root GraphQL http handler
 package graphql
 
 import (
@@ -10,6 +11,7 @@ import (
 	"net/http"
 )
 
+// Handler is the root GraphQL http handler
 type Handler struct {
 	http.HandlerFunc
 	*resolvers.RootResolver

graphql/relay.go 🔗

@@ -1,37 +0,0 @@
-package graphql
-
-import (
-	"encoding/base64"
-	"strings"
-)
-
-type ResolvedGlobalID struct {
-	Type string `json:"type"`
-	ID   string `json:"id"`
-}
-
-// Takes a type name and an ID specific to that type name, and returns a
-// "global ID" that is unique among all types.
-func ToGlobalID(ttype string, id string) string {
-	str := ttype + ":" + id
-	encStr := base64.StdEncoding.EncodeToString([]byte(str))
-	return encStr
-}
-
-// Takes the "global ID" created by toGlobalID, and returns the type name and ID
-// used to create it.
-func FromGlobalID(globalID string) *ResolvedGlobalID {
-	strID := ""
-	b, err := base64.StdEncoding.DecodeString(globalID)
-	if err == nil {
-		strID = string(b)
-	}
-	tokens := strings.Split(strID, ":")
-	if len(tokens) < 2 {
-		return nil
-	}
-	return &ResolvedGlobalID{
-		Type: tokens[0],
-		ID:   tokens[1],
-	}
-}

input/input.go 🔗

@@ -1,5 +1,7 @@
-// Originally taken from the git-appraise project
+// Inspired by the git-appraise project
 
+// Package input contains helpers to use a text editor as an input for
+// various field of a bug
 package input
 
 import (

operations/operations.go 🔗

@@ -1,3 +1,6 @@
+// Package operations contains the various bug operations. A bug operation is
+// an atomic edit operation of a bug state. These operations are applied
+// sequentially to compile the current state of the bug.
 package operations
 
 import (

termui/termui.go 🔗

@@ -1,3 +1,4 @@
+// Package termui contains the interactive terminal UI
 package termui
 
 import (

webui/Readme.md 🔗

@@ -0,0 +1,16 @@
+# git-bug rich web UI
+
+## How to develop
+
+1. Compile the go binary
+   - run `make` in the **root** directory
+2. Run the GraphQL backend on the port 3001
+   - `./git-bug webui -p 3001`
+3. Run the hot-reloadable development WebUI
+   - run `npm start` in the **webui** directory
+   
+The development version of the WebUI is configured to query the backend on the port 3001. You can now live edit the js code and use the normal backend.
+
+## Bundle the web UI
+
+Once the webUI is good enough for a new release, run `make pack-webui` from the root directory to bundle the compiled js into the go binary.