From f1fc44efd4dc06d5ef161ae48c4a8a08af89d5b9 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 14 Nov 2022 15:06:20 +0100 Subject: [PATCH] docs: add 0.47 to docs (#13852) --- .gitignore | 7 ------- Makefile | 18 +----------------- docs/.gitignore | 9 +++++++++ docs/README.md | 7 +++++-- docs/build-all.sh | 27 +++++++++++++++++++++++++++ docs/docusaurus.config.js | 16 ++++++---------- docs/versions.json | 3 +++ x/distribution/README.md | 2 +- x/nft/README.md | 13 +++++++++---- 9 files changed, 61 insertions(+), 41 deletions(-) create mode 100755 docs/build-all.sh create mode 100644 docs/versions.json diff --git a/.gitignore b/.gitignore index 7c86c71295..195f47915e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,13 +14,6 @@ private # Build vendor build -docs/node_modules -docs/docs/modules -docs/docs/spec -docs/docs/architecture -docs/docs/tooling/01-cosmovisor.md -docs/docs/tooling/02-depinject.md -docs/run-node/04-rosetta.md dist tools-stamp buf-stamp diff --git a/Makefile b/Makefile index 72df76ec8a..46a3c02154 100644 --- a/Makefile +++ b/Makefile @@ -185,24 +185,8 @@ godocs: @echo "--> Wait a few seconds and visit http://localhost:6060/pkg/github.com/cosmos/cosmos-sdk/types" godoc -http=:6060 -# This builds the docs.cosmos.network docs using docusaurus. -# Old documentation, which have not been migrated to docusaurus are generated with vuepress. build-docs: - @echo "building docusaurus docs" - @cd docs && npm ci && npm run build - mv docs/build ~/output - - @echo "building old docs" - @cd docs && \ - while read -r branch path_prefix; do \ - echo "building vuepress $${branch} docs" ; \ - (git clean -fdx && git reset --hard && git checkout $${branch} && npm install && VUEPRESS_BASE="/$${path_prefix}/" npm run build) ; \ - mkdir -p ~/output/$${path_prefix} ; \ - cp -r .vuepress/dist/* ~/output/$${path_prefix}/ ; \ - done < vuepress_versions ; - - @echo "setup domain" - @echo $(DOCS_DOMAIN) > ~/output/CNAME + @cd docs && sh ./build-all.sh .PHONY: build-docs diff --git a/docs/.gitignore b/docs/.gitignore index e6e9ac43d2..3f2d979148 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -7,6 +7,15 @@ # Generated files .docusaurus .cache-loader +versioned_docs +versioned_sidebars +docs/node_modules +docs/docs/modules +docs/docs/spec +docs/docs/architecture +docs/docs/tooling/01-cosmovisor.md +docs/docs/tooling/02-depinject.md +docs/run-node/04-rosetta.md # Misc .DS_Store diff --git a/docs/README.md b/docs/README.md index 020a979374..ea2f47ced4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -62,7 +62,8 @@ make build-docs When a new major version of the SDK is released, the following steps should be taken: -* On the `release/vX.Y.Z` branch, remove the deploy action (`.github/workflows/deploy-docs.yml`), for avoiding deploying the docs from the release branches +* On the `release/vX.Y.Z` branch, remove the deploy action (`.github/workflows/deploy-docs.yml`), for avoiding deploying the docs from the release branches. +* On the `release/vX.Y.Z` branch, update `docusaurus.config.js` and set the `lastVersion` to `current`, remove all other versions from the config. * Each time a new version is released (on docusaurus), drop support from the oldest versions. * If the old version is still running vuepress (v0.45, v0.46), remove its line from `vuepress_versions` * If any, remove the outdated redirections from `docusaurus.config.js` and add the base version redirection (`/vX.XX`) to `/main`. @@ -74,6 +75,8 @@ When a new major version of the SDK is released, the following steps should be t }, ``` -* Add the new version sidebar to the list of versionned sidebar and add the version to `versions` +* Add the new version sidebar to the list of versionned sidebar and add the version to `versions.json`. +* Update the latest version (`presets[1].docs.lastVersion`) in `docusaurus.config.js`. +* Add the new version with in `presets[1].docs.versions` in `docusaurus.config.js`. Learn more about [versioning](https://docusaurus.io/docs/versioning) in Docusaurus. diff --git a/docs/build-all.sh b/docs/build-all.sh new file mode 100755 index 0000000000..66089cee65 --- /dev/null +++ b/docs/build-all.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# This builds the docs.cosmos.network docs using docusaurus. +# Old documentation, which have not been migrated to docusaurus are generated with vuepress. +COMMIT=$(git rev-parse HEAD) +mkdir -p ~/versioned_docs ~/versioned_sidebars +for version in $(jq -r .[] versions.json); do + echo "building docusaurus $version docs" + git clean -fdx && git reset --hard && git checkout release/$version.x + sh ./pre.sh + npm ci && npm run docusaurus docs:version $version + mv ./versioned_docs/* ~/versioned_docs/ + mv ./versioned_sidebars/* ~/versioned_sidebars/ +done +echo "building docusaurus main docs" +(git clean -fdx && git reset --hard && git checkout $COMMIT) +mv ~/versioned_docs ~/versioned_sidebars . +npm ci && npm run build +mv build ~/output +while read -r branch path_prefix; do + echo "building vuepress $branch docs" + (git clean -fdx && git reset --hard && git checkout $branch && npm install && VUEPRESS_BASE="/$path_prefix/" npm run build) + mkdir -p ~/output/$path_prefix + cp -r .vuepress/dist/* ~/output/$path_prefix/ +done < vuepress_versions +echo "setup domain" +echo $DOCS_DOMAIN > ~/output/CNAME \ No newline at end of file diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index af000f4404..bd0d2acff4 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -4,9 +4,6 @@ const lightCodeTheme = require("prism-react-renderer/themes/github"); const darkCodeTheme = require("prism-react-renderer/themes/dracula"); -// const lastVersion = "v0.47"; -const lastVersion = "current"; - /** @type {import('@docusaurus/types').Config} */ const config = { title: "Cosmos SDK", @@ -40,17 +37,16 @@ const config = { docs: { sidebarPath: require.resolve("./sidebars.js"), routeBasePath: "/", - lastVersion: lastVersion, + lastVersion: "v0.47", versions: { current: { path: "main", - // banner: "unreleased", + banner: "unreleased", + }, + "v0.47": { + path: "v0.47", + label: "v0.47", }, - // "v0.47": { - // label: "v0.47", - // path: "v0.47", - // banner: "none", - // }, }, }, theme: { diff --git a/docs/versions.json b/docs/versions.json new file mode 100644 index 0000000000..9ad5d64035 --- /dev/null +++ b/docs/versions.json @@ -0,0 +1,3 @@ +[ + "v0.47" +] \ No newline at end of file diff --git a/x/distribution/README.md b/x/distribution/README.md index df29ec9972..c9375437cc 100644 --- a/x/distribution/README.md +++ b/x/distribution/README.md @@ -100,7 +100,7 @@ In Proof of Stake (PoS) blockchains, rewards gained from transaction fees are pa Rewards are calculated per period. The period is updated each time a validator's delegation changes, for example, when the validator receives a new delegation. The rewards for a single validator can then be calculated by taking the total rewards for the period before the delegation started, minus the current total rewards. -To learn more, see the [F1 Fee Distribution paper](/docs/spec/fee_distribution/f1_fee_distr.pdf). +To learn more, see the [F1 Fee Distribution paper](https://github.com/cosmos/cosmos-sdk/tree/main/docs/spec/fee_distribution/f1_fee_distr.pdf). The commission to the validator is paid when the validator is removed or when the validator requests a withdrawal. The commission is calculated and incremented at every `BeginBlock` operation to update accumulated fee amounts. diff --git a/x/nft/README.md b/x/nft/README.md index a084b28f90..4f16a4aea4 100644 --- a/x/nft/README.md +++ b/x/nft/README.md @@ -10,13 +10,18 @@ sidebar_position: 1 `x/nft` is an implementation of a Cosmos SDK module, per [ADR 43](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-043-nft-module.md), that allows you to create nft classification, create nft, transfer nft, update nft, and support various queries by integrating the module. It is fully compatible with the ERC721 specification. -* [Concept](#concepts) +* [Concepts](#concepts) * [Class](#class) * [NFT](#nft) -*[State](#state) -*[Messages](#messages) +* [State](#state) + * [Class](#class-1) + * [NFT](#nft-1) + * [NFTOfClassByOwner](#nftofclassbyowner) + * [Owner](#owner) + * [TotalSupply](#totalsupply) +* [Messages](#messages) * [MsgSend](#msgsend) -*[Events](#events) +* [Events](#events) ## Concepts