Skip to content

Commit

Permalink
feat: Implement ./contribs/gnodev command (gnolang#1386)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton committed Jan 18, 2024
1 parent ce12db6 commit 2d84564
Show file tree
Hide file tree
Showing 63 changed files with 2,016 additions and 528 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:

- name: Check go.mods
run: |
set -e
set -xe
# Find all go.mod files
gomods=$(find . -type f -name go.mod)
Expand Down
14 changes: 12 additions & 2 deletions contribs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ help:
@cat Makefile | grep '^[a-z][^:]*:' | cut -d: -f1 | sort | sed 's/^/ /'

.PHONY: install
install: install.gnomd
install: install.gnomd install.gnodev

install.gnomd:; cd gnomd && go install .
install.gnomd:; cd gnomd && go install .
install.gnodev:; $(MAKE) -C ./gnodev install

.PHONY: clean
clean:
Expand All @@ -21,6 +22,15 @@ GOFMT_FLAGS ?= -w
fmt:
$(rundep) mvdan.cc/gofumpt $(GOFMT_FLAGS) .

.PHONY: tidy
tidy:
@for gomod in `find . -name go.mod`; do ( \
dir=`dirname $$gomod`; \
set -xe; \
cd $$dir; \
go mod tidy -v; \
); done

########################################
# Test suite
GOTEST_FLAGS ?= -v -p 1 -timeout=30m
Expand Down
9 changes: 9 additions & 0 deletions contribs/gnodev/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
GNOROOT_DIR ?= $(abspath $(lastword $(MAKEFILE_LIST))/../../../)

GOBUILD_FLAGS := -ldflags "-X github.com/gnolang/gno/gnovm/pkg/gnoenv._GNOROOT=$(GNOROOT_DIR)"

install:
go install $(GOBUILD_FLAGS) .

build:
go build $(GOBUILD_FLAGS) -o build/gnodev ./cmd/gno
24 changes: 24 additions & 0 deletions contribs/gnodev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## `gnodev`: Your Gno Companion Tool

`gnodev` is designed to be a robust and user-friendly tool in your realm package development journey, streamlining your workflow and enhancing productivity.

### Synopsis
**gnodev** [**-minimal**] [**-no-watch**] [**PKGS_PATH ...**]

### Features
- **In-Memory Node**: Automatically loads the **example** folder and any user-specified paths.
- **Web Interface Server**: Starts a gno.land web server on `:8888`.
- **Hot Reload**: Monitors the example packages folder and additional directories for file changes, reloading the package and restarting the node as needed.
- **State Maintenance**: Ensures the current state is maintained by reapplying all previous blocks.

### Commands
- **H**: Display help information.
- **R**: Reload the node.
- **Ctrl+R**: Reset the current node state.
- **Ctrl+C**: Exit the command.

### Example Folder Loading
The **example** package folder is loaded automatically. If working within this folder, you don't have to specify any additional paths to `gnodev`. Use `--minimal` to prevent this.

### Installation
Run `make install` to install `gnodev`.
60 changes: 60 additions & 0 deletions contribs/gnodev/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module github.com/gnolang/gno/contribs/gnodev

go 1.20

replace github.com/gnolang/gno => ../..

require (
github.com/fsnotify/fsnotify v1.7.0
github.com/gnolang/gno v0.0.0-00010101000000-000000000000
golang.org/x/term v0.15.0
)

require (
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dgraph-io/badger/v3 v3.2103.4 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/gnolang/goleveldb v0.0.9 // indirect
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gotuna/gotuna v0.6.0 // indirect
github.com/jaekwon/testify v1.6.1 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.8.5 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/peterbourgon/ff/v3 v3.4.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.22.5 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 2d84564

Please sign in to comment.