This Node.js application uses Vuepress to render a static documentation page.
This repository uses a git submodule for the theme. Initialize and update all submodules automatically using:
git clone --recursive git@github.com:cosmos/sdk-tutorials.git
This application requires node version >=14! Install the application with:
npm install
You can run a live preview of the platform using:
npm run serve
This will start a local server on localhost:8081.
A distribution package can be built using:
npm run build
The build output can be found in ./vuepress/dist
.
WIP - Information for content authors (internal and external)
This sections lists technical details for content authors. For general information, language, and style details, see the Contribution Guidelines.
The main config file is located at .vuepress/config.js
.
The platform has multiple navigation components:
- Sidebar menu - main menu at the left, overview of all modules and sections
- Right sidebar - on-page navigation (automatically created from headlines)
- End of page navigation (Back/Next)
- Landing pages
- Footer
- Top bar
The main menu is configured in the main config, within the sidebar
- nav
object. This config defines the sidebar as well as the end of page navigation.
An example configuration might look like this, where each module is defined as a child of the root:
{
title: "Cosmos Academy",
children: [
{
title: "Welcome",
path: "/academy/0-welcome/",
directory: false,
},
{
title: "What is Cosmos?",
path: "/academy/1-what-is-cosmos",
directory: true,
}
}
title
- Module namepath
- Full path to the folderdirectory
- When enabled, all content files found in the folder will be linked as child pages automatically. This creates an expandable module in the sidebar. Otherwise, only one link will be added to the sidebar, pointing to the file specified inpath
. If this is a folder, theindex.md
inside it will be linked.
You can also define the child pages of a module manually:
{
title: "Week 1 - Cosmos and Its Main Concepts",
directory: true,
order: 2,
children: [
{
title: "Cosmos and its Main Concepts",
path: "/course-ida/landingpages/week1-lp.html"
},
{
title: "Blockchain Technology and Cosmos",
path: "/academy/1-what-is-cosmos/1-blockchain-and-cosmos.html"
}
}
You can extend the main config to add new modules and pages. However, if you add a new folder at the root level, you must also adjust the file search patterns at the very end of the config:
patterns: [
"README.md",
"academy/*/*.md",
"tutorials/*/*.md"
]
If you create a new folder named myfiles
, add "myfiles/*/*.md"
to the list.
Images must be linked using an absolute path! On build, images are automatically resized and compressed into a set with different sizes, defined in the vuepress config:
assetsOptimization: {
breakpoints: [200, 600, 988, 1200]
}
The platform also has a zoom feature, which is automatically enabled on all embedded images.
There is a hidden file (not linked in the main menu) published at /feature-test, which demonstrates the use of all custom components used on this platform. This page is also available on the deployed website at https://tutorials.cosmos.network/feature-test/.
This repository contains the content for two different deployments at once:
- The main platform, deployed to tutorials.cosmos.network.
- The Interchain Developer Academy platform (IDA) interchainacademy.cosmos.network.
The content for both platforms lives on the master
branch. When building the project (npm run build
and npm run serve
), you are building the main platform. The IDA platform uses the same base files, but then adds additional changes on top of them (mostly different landing pages, menu adjustments, and small differences on a few content pages).
In general, there are three types of files:
- Files only used on one platform.
- Files used on both platforms, with the same content.
- Files used on both platforms with different content. This includes config files (
.vuepress/config.js
).
The first two types of files do not require any special treatment. Only the last type - files used on both platforms which contain different content - requires you to undertake particular steps.
There is a separate folder for files with different content for the IDA platform in the repository root, named ida-customizations
. When building the IDA platform, the content of this folder is copied into the main folder, overwriting the main platform files. For example, the file /academy/whats-next/index.md
(main platform) has an IDA variation in /ida-customizations/academy/whats-next/index.md
. When building the IDA platform, the original file will be overwritten with the IDA file version before building. Similarly, there is an IDA specific config in /ida-customizations/.vuepress/config.js
There are two helper scripts available to switch between the main platform and the IDA platform variants:
- Use
npm run switch-ida
to change your local file system to the IDA platform variant (copy in the IDA files). - Use
npm run switch-main
to switch back to the main platform variant (this moves your changes into theida-customizations
folder).
NOTE: Your working directory must be clean before switching to the IDA files.
When you switch back to the main variant, changes will be moved into the ida-customizations
folder, and the original files are restored. The script uses git stash
to restore the main files, so in case of an inadvertent switch (or any error) you can restore your original changes (see git stash list
and git stash pop
). Note however that any changes in the ida-customizations
folder will be overwritten by this script!
To work on the IDA platform files, starting from a clean master
:
- Run
npm run switch-ida
to switch your local filesystem to the IDA variant. - You can now run
npm run serve
and work on the files as usual. - Once you are done with your updates, stop your server and run
npm run switch-main
. This will move your changes into theida-customizations
folder and restore the main platform files. - Add the files in
ida-customizations
to your commit and push tomaster
.
- Install Visual Studio Code.
- Click Extensions in the sidebar.
- Install these extensions:
- When prompted:
- Enter
go get -v golang.org/x/tools/gopls
. - Select
Install all
for all packages.
- Enter
Be sure to set up Visual Studio Code for your environment.
Tip On MacOS, install code
in $PATH to enable Launching Visual Studio Code from the command line. Open the Command Palette (Cmd+Shift+P) and type 'shell command'.
Click the GitHub icon in the sidebar for GitHub integration and follow the prompts.
It is recommended that you master your terminal to be happy.
On MacOS, install the iTerm2 OSS terminal emulator as a replacement for the default Terminal app. Installing iTerm2 as a replacement for Terminal provides an updated version of the Bash shell that supports useful features like programmable completion.
The Z shell, also known as Zsh, is a UNIX shell that is built on top of the macOS default Bourne shell.
-
If you want to set your default shell to Zsh, install and set up Zsh as the default shell.
-
Install these plugins:
-
Edit your
~/.zshrc
file to add the plugins to load on startup:plugins=( git zsh-autosuggestions zsh-syntax-highlighting )
-
Log out and log back in to the terminal to use your new default Zsh shell.
This installation method removes existing Go installations, installs Go in /usr/local/go/bin/go
, and sets the environment variables.
- Go to https://golang.org/dl.
- Download the binary release that is suitable for your system.
- Follow the installation instructions.
Note: We recommend not using brew to install Go.
WIP - Information for content authors (internal and external).
This repository contains the content for two different deployments at once:
- The main platform, deployed to tutorials.cosmos.network.
- The Interchain Developer Academy platform (IDA) interchainacademy.cosmos.network.
The content for both platforms lives on the master
branch. When building the project (npm run build
and npm run serve
), you are building the main platform. The IDA platform uses the same base files, but then adds additional changes on top of them (mostly different landing pages, menu adjustments, and small differences on a few content pages).
In general, there are three types of files:
- Files only used on one platform.
- Files used on both platforms, with the same content.
- Files used on both platforms with different content. This includes config files (
.vuepress/config.js
)
The first two types of files do not require any special treatment. Only the last type - files used on both platforms which contain different content - requires you to undertake particular steps
There is a separate folder for files with different content for the IDA platform in the repository root, named ida-customizations
. When building the IDA platform, the content of this folder is copied into the main folder, overwriting the main platform files. For example, the file /academy/whats-next/index.md
(main platform) has an IDA variation in /ida-customizations/academy/whats-next/index.md
. When building the IDA platform, the original file will be overwritten with the IDA file version before building. Similarly, there is an IDA specific config in /ida-customizations/.vuepress/config.js
There are two helper scripts available to switch between the main platform and the IDA platform variants.
- Use
npm run switch-ida
to change your local filesystem to the IDA platform variant (copy in the IDA files). - Use
npm run switch-main
to switch back to the main platform variant (this moves your changes into theida-customizations
folder).
NOTE: Your working directory must be clean before switching to the IDA files.
When you switch back to the main variant, changes will be moved into the ida-customizations
folder, and the original files are restored. The script uses git stash
to restore the main files, so in case of an inadvertent switch (or any error) you can restore your original changes (see git stash list
and git stash pop
). Note however that any changes in the ida-customizations
folder will be overwritten by this script!
To work on the IDA platform files, starting from a clean master
:
- Run
npm run switch-ida
to switch your local filesystem to the IDA variant. - You can now run
npm run serve
and work on the files as usual. - Once you are done with your updates, stop your server and run
npm run switch-main
. This will move your changes into theida-customizations
folder and restore the main platform files. - Add the files in
ida-customizations
to your commit and push tomaster
.