From 7fe0f2004b763d47e3d2c78f77b8d306b76b4c58 Mon Sep 17 00:00:00 2001 From: Manfred Touron <94029+moul@users.noreply.github.com> Date: Sun, 7 Jul 2024 08:35:36 -0700 Subject: [PATCH] chore: update docs/' Makefile and CI (#2534) - add 'make build' (embedmd) - refactor Makefile (simplified) - check on CI that docs/ is "built" (no diff) Related (but not closing) #2532 Part of #2529 --------- Signed-off-by: moul <94029+moul@users.noreply.github.com> --- .github/workflows/{docs-linter.yml => docs.yml} | 3 +++ docs/Makefile | 8 +++----- docs/concepts/concepts.md | 2 +- docs/concepts/stdlibs/coin.md | 2 +- docs/concepts/stdlibs/stdlibs.md | 2 +- docs/concepts/testnets.md | 2 +- docs/getting-started/getting-started.md | 2 +- .../local-setup/interacting-with-gnoland.md | 2 +- docs/getting-started/local-setup/local-setup.md | 2 +- docs/getting-started/playground-start.md | 2 +- docs/gno-infrastructure/gno-infrastructure.md | 2 +- docs/gno-infrastructure/premining-balances.md | 2 +- docs/how-to-guides/creating-grc20.md | 3 +-- docs/how-to-guides/how-to-guides.md | 2 +- docs/how-to-guides/simple-library.md | 2 +- docs/how-to-guides/testing-gno.md | 2 +- docs/how-to-guides/write-simple-dapp.md | 1 - docs/reference/network-config.md | 2 +- docs/reference/reference.md | 2 +- docs/reference/stdlibs/std/realm.md | 2 +- misc/devdeps/Makefile | 3 +++ misc/devdeps/deps.go | 3 +++ misc/devdeps/go.mod | 2 ++ misc/devdeps/go.sum | 2 ++ 24 files changed, 33 insertions(+), 24 deletions(-) rename .github/workflows/{docs-linter.yml => docs.yml} (78%) diff --git a/.github/workflows/docs-linter.yml b/.github/workflows/docs.yml similarity index 78% rename from .github/workflows/docs-linter.yml rename to .github/workflows/docs.yml index e56c1a663ea..18d75e46a81 100644 --- a/.github/workflows/docs-linter.yml +++ b/.github/workflows/docs.yml @@ -27,5 +27,8 @@ jobs: - name: Build docs run: make -C docs/ build + - name: Check diff + run: git diff --exit-code || (echo "Some docs files are not formatted, please run 'make build'." && exit 1) + - name: Run linter run: make -C docs/ lint diff --git a/docs/Makefile b/docs/Makefile index e5bf557ef75..c642cdbbe8e 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,11 +2,9 @@ all: build lint # Build the linter build: - cd ../misc/docs-linter && go build -o ./build/ + go run -modfile ../misc/devdeps/go.mod github.com/campoy/embedmd -w `find . -name "*.md"` # Run the linter for the docs/ folder lint: - ../misc/docs-linter/build/linter -path . - -clean: - rm -rf ../misc/docs-linter/build \ No newline at end of file + go build -C ../misc/docs-linter -o ./build + ../misc/docs-linter/build -path . diff --git a/docs/concepts/concepts.md b/docs/concepts/concepts.md index 4c9949ddd0d..88deb4129f1 100644 --- a/docs/concepts/concepts.md +++ b/docs/concepts/concepts.md @@ -5,4 +5,4 @@ id: concepts # Concepts Welcome to the **Concepts** section for Gno. This section outlines the most important -concepts related to Gno & Gno.land. \ No newline at end of file +concepts related to Gno & Gno.land. diff --git a/docs/concepts/stdlibs/coin.md b/docs/concepts/stdlibs/coin.md index 50a0e65829d..46c7c519f7c 100644 --- a/docs/concepts/stdlibs/coin.md +++ b/docs/concepts/stdlibs/coin.md @@ -32,4 +32,4 @@ which can manipulate them depending on access rights. Read more about coins in the [Effective Gno](../effective-gno.md#coins) section. -The Coin(s) API can be found in under the `std` package [reference](../../reference/stdlibs/std/coin.md). \ No newline at end of file +The Coin(s) API can be found in under the `std` package [reference](../../reference/stdlibs/std/coin.md). diff --git a/docs/concepts/stdlibs/stdlibs.md b/docs/concepts/stdlibs/stdlibs.md index ae0bb5b55bb..698bbabbd51 100644 --- a/docs/concepts/stdlibs/stdlibs.md +++ b/docs/concepts/stdlibs/stdlibs.md @@ -71,4 +71,4 @@ where you cloned the Gno repository. ```sh export GNOROOT=$HOME/gno -``` \ No newline at end of file +``` diff --git a/docs/concepts/testnets.md b/docs/concepts/testnets.md index dd6d65085cc..27e7f687e21 100644 --- a/docs/concepts/testnets.md +++ b/docs/concepts/testnets.md @@ -112,4 +112,4 @@ Release commit: [652dc7a](https://github.com/gnolang/gno/commit/652dc7a3a62ee043 The first Gno testnet. Find archive data [here](https://github.com/gnolang/tx-exports/tree/main/test1.gno.land). Launch date: May 6th 2022 -Release commit: [797c7a1](https://github.com/gnolang/gno/commit/797c7a132d65534df373c63b837cf94b7831ac6e) \ No newline at end of file +Release commit: [797c7a1](https://github.com/gnolang/gno/commit/797c7a132d65534df373c63b837cf94b7831ac6e) diff --git a/docs/getting-started/getting-started.md b/docs/getting-started/getting-started.md index fba9ec387af..c60a0bfb433 100644 --- a/docs/getting-started/getting-started.md +++ b/docs/getting-started/getting-started.md @@ -6,4 +6,4 @@ id: getting-started Welcome to the **Getting Started** section for Gno. This section outlines how to get started with Gno by using the Gno Playground, as well as how to set up a -local development environment, get funds, deploy packages, etc. \ No newline at end of file +local development environment, get funds, deploy packages, etc. diff --git a/docs/getting-started/local-setup/interacting-with-gnoland.md b/docs/getting-started/local-setup/interacting-with-gnoland.md index adc7788dcaf..119a1698cde 100644 --- a/docs/getting-started/local-setup/interacting-with-gnoland.md +++ b/docs/getting-started/local-setup/interacting-with-gnoland.md @@ -94,4 +94,4 @@ to see your address on the main page of the Userbook realm. This concludes the "Local Setup" tutorial. For next steps, see the [How-to guides section](../../how-to-guides/how-to-guides.md), where you will -learn how to write your first realm, package, and much more. \ No newline at end of file +learn how to write your first realm, package, and much more. diff --git a/docs/getting-started/local-setup/local-setup.md b/docs/getting-started/local-setup/local-setup.md index 669528e61d3..36d2a414de7 100644 --- a/docs/getting-started/local-setup/local-setup.md +++ b/docs/getting-started/local-setup/local-setup.md @@ -5,4 +5,4 @@ id: local-setup # Local setup This section will show you how to set up a local environment for Gno development. It includes instructions for installation, setting up a Gno.land keypair, -browsing Gno source code, and more. \ No newline at end of file +browsing Gno source code, and more. diff --git a/docs/getting-started/playground-start.md b/docs/getting-started/playground-start.md index 42bdd9718a2..a39aaa11c8a 100644 --- a/docs/getting-started/playground-start.md +++ b/docs/getting-started/playground-start.md @@ -101,4 +101,4 @@ exploring the [Concepts](../concepts/concepts.md) section. To get started writing Gno code, check out the [How-to](../how-to-guides/how-to-guides.md) section, the `examples/` folder on the [Gno monorepo](https://github.com/gnolang/gno), or one of many community projects and tutorials found in the -[awesome-gno](https://github.com/gnolang/awesome-gno/blob/main/README.md) repo on GitHub. \ No newline at end of file +[awesome-gno](https://github.com/gnolang/awesome-gno/blob/main/README.md) repo on GitHub. diff --git a/docs/gno-infrastructure/gno-infrastructure.md b/docs/gno-infrastructure/gno-infrastructure.md index 16ec8a7b53a..aa301fa79d4 100644 --- a/docs/gno-infrastructure/gno-infrastructure.md +++ b/docs/gno-infrastructure/gno-infrastructure.md @@ -6,4 +6,4 @@ id: gno-infrastructure Welcome to the **Gno Infrastructure** section. This section is meant for users wanting to learn how to run their own Gno node, set up their own faucet, run -an indexer service, and more. \ No newline at end of file +an indexer service, and more. diff --git a/docs/gno-infrastructure/premining-balances.md b/docs/gno-infrastructure/premining-balances.md index 96924dea6a1..a817eb43f8c 100644 --- a/docs/gno-infrastructure/premining-balances.md +++ b/docs/gno-infrastructure/premining-balances.md @@ -102,4 +102,4 @@ Let's break down this command: That's it 🎉 You have successfully premined a native currency balance on a locally-running Gno chain! Additionally, you have also learned how to query the native currency balance for an address, using built-in ABCI queries -and the `gnokey` tool. \ No newline at end of file +and the `gnokey` tool. diff --git a/docs/how-to-guides/creating-grc20.md b/docs/how-to-guides/creating-grc20.md index 4c43f02b454..b7507946e5b 100644 --- a/docs/how-to-guides/creating-grc20.md +++ b/docs/how-to-guides/creating-grc20.md @@ -22,8 +22,6 @@ the main functionality of our token realm. The package can be found at the [embedmd]:# (../assets/how-to-guides/creating-grc20/mytoken-1.gno go) ```go -package mytoken - import ( "std" "strings" @@ -48,6 +46,7 @@ func init() { // Mint 1 million tokens to admin mytoken.Mint(admin, 1000000*10000) } + ``` The code snippet above does the following: diff --git a/docs/how-to-guides/how-to-guides.md b/docs/how-to-guides/how-to-guides.md index eeaee9c24f1..5c3425f2c54 100644 --- a/docs/how-to-guides/how-to-guides.md +++ b/docs/how-to-guides/how-to-guides.md @@ -6,4 +6,4 @@ id: how-to-guides Welcome to the **How-to Guides** section for Gno. This section outlines how to complete specific tasks related to Gno, such as writing a realm & package, deploying -code to the chain, creating a GRC20 or GRC721 token, etc. \ No newline at end of file +code to the chain, creating a GRC20 or GRC721 token, etc. diff --git a/docs/how-to-guides/simple-library.md b/docs/how-to-guides/simple-library.md index 923fc98922e..62ff2bd2c0f 100644 --- a/docs/how-to-guides/simple-library.md +++ b/docs/how-to-guides/simple-library.md @@ -127,7 +127,7 @@ var listOfTapas = []string{ // GetTapaSuggestion randomly selects and returns a tapa suggestion func GetTapaSuggestion(userInput string) string { - // Create a pseudorandom number depending on the block height. + // Create a random number depending on the block height. // We get the block height using std.GetHeight(), which is from an imported Gno library, "std" // Note: this value is not fully random and is easily guessable randomNumber := int(std.GetHeight()) % len(listOfTapas) diff --git a/docs/how-to-guides/testing-gno.md b/docs/how-to-guides/testing-gno.md index 3ba734abba4..e32a9435711 100644 --- a/docs/how-to-guides/testing-gno.md +++ b/docs/how-to-guides/testing-gno.md @@ -184,4 +184,4 @@ in the [Standard Library](../concepts/stdlibs/stdlibs.md) reference section. That's it 🎉 You have successfully written and tested Gno code. Additionally, you have utilized the `gno test` tool, and understood -how it can be configured to make the developer experience smooth. \ No newline at end of file +how it can be configured to make the developer experience smooth. diff --git a/docs/how-to-guides/write-simple-dapp.md b/docs/how-to-guides/write-simple-dapp.md index 851320b2a61..f30a5fa5502 100644 --- a/docs/how-to-guides/write-simple-dapp.md +++ b/docs/how-to-guides/write-simple-dapp.md @@ -135,7 +135,6 @@ The realm will contain the following functionality: package poll import ( - "bytes" "std" "gno.land/p/demo/avl" diff --git a/docs/reference/network-config.md b/docs/reference/network-config.md index 7902ec5e7f6..97c2fc886e9 100644 --- a/docs/reference/network-config.md +++ b/docs/reference/network-config.md @@ -16,4 +16,4 @@ All networks follow the same pattern for websocket connections: ```shell wss:///websocket -``` \ No newline at end of file +``` diff --git a/docs/reference/reference.md b/docs/reference/reference.md index acef30f1083..a635370c62f 100644 --- a/docs/reference/reference.md +++ b/docs/reference/reference.md @@ -5,4 +5,4 @@ id: reference # Reference Welcome to the **Reference** section for Gno. This section outlines common APIs, -network configurations, client usages, etc. \ No newline at end of file +network configurations, client usages, etc. diff --git a/docs/reference/stdlibs/std/realm.md b/docs/reference/stdlibs/std/realm.md index aee63585e37..0c99b7134ea 100644 --- a/docs/reference/stdlibs/std/realm.md +++ b/docs/reference/stdlibs/std/realm.md @@ -38,4 +38,4 @@ Checks if the realm it was called upon is a user realm. #### Usage ```go if r.IsUser() {...} -``` \ No newline at end of file +``` diff --git a/misc/devdeps/Makefile b/misc/devdeps/Makefile index 54df62cc031..6b414555c97 100644 --- a/misc/devdeps/Makefile +++ b/misc/devdeps/Makefile @@ -1,3 +1,6 @@ install: go install mvdan.cc/gofumpt go install google.golang.org/protobuf/cmd/protoc-gen-go + +tidy: + go mod tidy diff --git a/misc/devdeps/deps.go b/misc/devdeps/deps.go index 7ac068c71ac..a011868e4c2 100644 --- a/misc/devdeps/deps.go +++ b/misc/devdeps/deps.go @@ -26,4 +26,7 @@ import ( // linter _ "github.com/golangci/golangci-lint/cmd/golangci-lint" + + // embedmd + _ "github.com/campoy/embedmd/embedmd" ) diff --git a/misc/devdeps/go.mod b/misc/devdeps/go.mod index 653641931b4..2ca693afc93 100644 --- a/misc/devdeps/go.mod +++ b/misc/devdeps/go.mod @@ -13,6 +13,8 @@ require ( mvdan.cc/gofumpt v0.6.0 ) +require github.com/campoy/embedmd v1.0.0 + require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect 4d63.com/gochecknoglobals v0.2.1 // indirect diff --git a/misc/devdeps/go.sum b/misc/devdeps/go.sum index 0c9750c4e03..4c3f84b6df7 100644 --- a/misc/devdeps/go.sum +++ b/misc/devdeps/go.sum @@ -98,6 +98,8 @@ github.com/butuzov/ireturn v0.3.0 h1:hTjMqWw3y5JC3kpnC5vXmFJAWI/m31jaCYQqzkS6PL0 github.com/butuzov/ireturn v0.3.0/go.mod h1:A09nIiwiqzN/IoVo9ogpa0Hzi9fex1kd9PSD6edP5ZA= github.com/butuzov/mirror v1.2.0 h1:9YVK1qIjNspaqWutSv8gsge2e/Xpq1eqEkslEUHy5cs= github.com/butuzov/mirror v1.2.0/go.mod h1:DqZZDtzm42wIAIyHXeN8W/qb1EPlb9Qn/if9icBOpdQ= +github.com/campoy/embedmd v1.0.0 h1:V4kI2qTJJLf4J29RzI/MAt2c3Bl4dQSYPuflzwFH2hY= +github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8= github.com/catenacyber/perfsprint v0.7.1 h1:PGW5G/Kxn+YrN04cRAZKC+ZuvlVwolYMrIyyTJ/rMmc= github.com/catenacyber/perfsprint v0.7.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg=