diff --git a/bug/bug.go b/bug/bug.go index 3342ecfaf057719597a20355975d23868b2427ce..98d8b2ce817b179a8a46c0d58ecbc6410ff59bee 100644 --- a/bug/bug.go +++ b/bug/bug.go @@ -1,3 +1,4 @@ +// Package bug contains the bug data model and low-level related functions package bug import ( diff --git a/cache/doc.go b/cache/doc.go new file mode 100644 index 0000000000000000000000000000000000000000..aa6caebda45de89cf10a3ef1c51373a34e2ec67b --- /dev/null +++ b/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 diff --git a/commands/root.go b/commands/root.go index edfb5b2bd0dc49012a4c426e24554e376906ffee..95a43516031bd0af5e7f07805a987f18e2427ef0 100644 --- a/commands/root.go +++ b/commands/root.go @@ -1,3 +1,4 @@ +// Package commands contains the CLI commands package commands import ( diff --git a/graphql/connections/connections.go b/graphql/connections/connections.go index 8b905fabdfb402e60018402d754cdcc32d81a6db..de5b8f1a53c4b7f98cf38083aea9098bcfcce7d6 100644 --- a/graphql/connections/connections.go +++ b/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 ( diff --git a/graphql/handler.go b/graphql/handler.go index 7b940d8fc7f29f7023dfae4b35254ec20241f054..ed5047c48cd17f63a459fef903633e37bcbc5525 100644 --- a/graphql/handler.go +++ b/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 diff --git a/graphql/models/models.go b/graphql/models/models.go index 63d9c1fed32a8ffc030914aa0939ae7b2c0a590c..816a04a878c3a79da658fc019446e4aaede891c0 100644 --- a/graphql/models/models.go +++ b/graphql/models/models.go @@ -1,3 +1,4 @@ +// Package models contains the various GraphQL data models package models import ( diff --git a/graphql/relay.go b/graphql/relay.go deleted file mode 100644 index 036ab54e4f294a3ecd820b86d5ac3f43b6616e6b..0000000000000000000000000000000000000000 --- a/graphql/relay.go +++ /dev/null @@ -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], - } -} diff --git a/graphql/resolvers/root.go b/graphql/resolvers/root.go index 1003f7f1c4592889fd87c7f0b1c8652f3dbdc603..ff181784ef603492dd9a8d5ac048157c2a6dbf97 100644 --- a/graphql/resolvers/root.go +++ b/graphql/resolvers/root.go @@ -1,3 +1,4 @@ +// Package resolvers contains the various GraphQL resolvers package resolvers import ( diff --git a/input/input.go b/input/input.go index 4da73fc5d16a8657f0facdae75bd9cc81462f202..4b70bbd4cf445e198d258c8e8ced50f6db43695e 100644 --- a/input/input.go +++ b/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 ( diff --git a/operations/operations.go b/operations/operations.go index 348f8cc821419a972383dfe6ae7ebf072ea1560b..020b81516a41ad20af265d37aa955086c39904cb 100644 --- a/operations/operations.go +++ b/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 ( diff --git a/termui/termui.go b/termui/termui.go index 54324c6133040260ec2f9b861cc66a206e5fe625..403fcc97f4840dc0b2d459dcb2734d16fbb6e96e 100644 --- a/termui/termui.go +++ b/termui/termui.go @@ -1,3 +1,4 @@ +// Package termui contains the interactive terminal UI package termui import ( diff --git a/webui/Readme.md b/webui/Readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e75fa6b837fd1fb47210b846924e848994e9568c --- /dev/null +++ b/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. \ No newline at end of file