Skip to content

Commit

Permalink
make the docs website work as a statically generated website
Browse files Browse the repository at this point in the history
  • Loading branch information
macku99 committed Aug 10, 2023
1 parent 5b9c32d commit b832f21
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 141 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MEILISEARCH_HOST=https://meilisearch.archway.tech
MEILISEARCH_INDEX=dev_ARCHWAY_DOCS #prod_ARCHWAY_DOCS
MEILISEARCH_SEARCH_API_KEY=
MEILISEARCH_WRITE_API_KEY=
MEILISEARCH_INDEX=dev_ARCHWAY_DOCS #prod_ARCHWAY_DOCS
MEILISEARCH_HOST=https://meilisearch.archway.tech
2 changes: 1 addition & 1 deletion components/Navigation/NavigationItems.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { PropType } from 'vue';
import NavigationItem from '@/components/Navigation/NavigationItem.vue';
import { Section, useNavigation, useSections } from '@/data';
import { Section, useNavigation } from '@/data';
const props = defineProps({
selectedSection: { type: Object as PropType<Section>, required: true },
Expand Down
19 changes: 10 additions & 9 deletions components/NextPrevArticle.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<script setup lang="ts">
import { onMounted } from 'vue';
import { Link } from '@/components/Ui';
const { prev, next } = useContent();
</script>
<template>
<nav class="flex gap-4 mt-12">
<Link class="rounded-2xl grow shrink basis-0 p-6 no-underline bg-gray-1100 dark:bg-black-100" v-if="prev" :href="prev._path"
><p class="my-0.5 font-medium">Previous</p>
<p class="my-0.5 font-bold">{{ prev.title }}</p></Link
>
<Link class="rounded-2xl grow shrink basis-0 p-6 no-underline bg-gray-1100 dark:bg-black-100" v-if="next" :href="next._path"
><p class="my-0.5 font-medium">Next</p>
<p class="my-0.5 font-bold">{{ next.title }}</p></Link
>
<nav class="flex justify-between gap-4 mt-12">
<Link class="w-1/2 flex flex-col space-y-1 rounded-2xl p-6 no-underline bg-gray-1100 dark:bg-black-100" :href="prev._path" v-if="prev">
<span class="font-medium">Previous</span>
<span class="font-bold">{{ prev.title }}</span>
</Link>
<Link class="w-1/2 flex flex-col space-y-1 rounded-2xl p-6 no-underline bg-gray-1100 dark:bg-black-100" :href="next._path" v-if="next">
<span class="font-medium">Next</span>
<span class="font-bold">{{ next.title }}</span>
</Link>
</nav>
</template>
89 changes: 0 additions & 89 deletions components/Test.vue

This file was deleted.

40 changes: 11 additions & 29 deletions content/2.developers/1.getting-started/1.install.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ To get started developing on the Archway Network, you will need to have the the

### Optional Dependencies


<a href="https://docs.docker.com/get-docker" target="_blank" title="Install Docker">Docker</a>
<a href="https://docs.docker.com/get-docker" target="_blank" title="Install Docker">Docker</a>

For local installations, you need root access to run **docker**. Make sure to follow all the steps with **root** access to prevent conflicts and confusions on the deployment process which requires root permission.

Expand All @@ -37,7 +36,6 @@ If you prefer, you can use <a href="https://docs.docker.com/engine/install/ubunt

<a href="https://go.dev/doc/install" target="_blank" >Golang</a>


In order to run **archwayd**, you will need to install <a href="https://go.dev/doc/install" target="_blank" >Golang</a>.

If you are using Ubuntu, for example, you would launch the command:
Expand All @@ -49,7 +47,6 @@ sudo apt install golang

::


## Rustc

**rustc**, provided by the <a href="https://www.rust-lang.org/" target="_blank" title="Rust Homepage">Rust</a> project maintainers, is the compiler for the Rust programming language. **rustc** takes your Rust source code and produces binary code as a library or an executable.
Expand Down Expand Up @@ -91,7 +88,6 @@ rustup target add wasm32-unknown-unknown

::


## Archwayd

**archwayd** is an implementation of a Cosmos zone with **wasm** smart contracts enabled.
Expand Down Expand Up @@ -185,10 +181,8 @@ For more information on running **archwayd** with the `archway-network/archwayd`

You can download the latest release of the pre-built binary from the <a href='https://github.com/archway-network/archway/releases' target='_blank'>releases page</a>.


For Linux, and depending on your architecture:


::tab-card{noOfTabs=2}
#title0
amd64
Expand Down Expand Up @@ -221,12 +215,6 @@ wget https://github.com/archway-network/archway/releases/download/$$archwayVersi

You can now verify the download by generating the sha256 hash for the downloaded file:







::tab-card{noOfTabs=2}
#title0
amd64
Expand Down Expand Up @@ -255,18 +243,18 @@ sha256sum archwayd_linux_arm64

::



Using the *sha256sum* should give you a string (i.e.
*4dd95ee0729b6593c9c390bde6e0c7bf3af0957d7f323e216b76ddb663fa7bc7*).
Using the _sha256sum_ should give you a string (i.e.
_4dd95ee0729b6593c9c390bde6e0c7bf3af0957d7f323e216b76ddb663fa7bc7_).

You can then download the sha256 checksum file relative to the release file:

::highlight-card

```bash
wget archwaysha256.txt https://github.com/archway-network/archway/releases/download/$$archwayVersion$$/archwayd_$$archwayVersion$$_checksums.txt

```

::

and you can compare that the sha256 hash strings match, By doing so, you are ensuring that the downloaded file matches the actual release file.
Expand All @@ -276,38 +264,39 @@ and you can compare that the sha256 hash strings match, By doing so, you are ens
After downloading the file, you can add executable permissions to it using the chmod command:

::highlight-card

```bash
chmod +x archwayd_linux_amd64
```
::

::

The above command makes the binary executable.

### Move the binary to the chosen directory

You can now move the binary to a directory in your PATH. The **/usr/local/bin directory** is commonly used for custom user programs not managed by the distribution package manager and is usually included in the **PATH**. You can move your file there with the **mv** command and also rename it to **archwayd** at the same time:

::highlight-card

```bash
sudo mv archwayd_linux_amd64 /usr/local/bin/archwayd
```

::

## Use the archwayd docker image

As an alternative, you can also use <a href="https://docs.docker.com/get-docker" target="_blank" title="Install Docker">Docker</a> (make sure to install it).


::alert{variant="warning"}
For Linux users, it's recommended to run the Docker daemon in <a href="https://docs.docker.com/engine/security/rootless/" target="_blank" title="Docker Rootless mode">Rootless Mode</a>.
#title
Warning
::


### Pull the docker image


You can pull the docker image from the following repositories:

- <a href="https://github.com/archway-network/archway/pkgs/container/archwayd" target="_blank">Production</a>
Expand All @@ -316,7 +305,6 @@ You can pull the docker image from the following repositories:

Make sure to pull the docker image relative to the latest <a href="https://github.com/archway-network/archway/releases" target="_blank">release</a>.


For example, to connect to the **Constantine** testnet, issue the following command:

::highlight-card
Expand All @@ -332,12 +320,8 @@ Make sure to always use the image tag that points to the network you want to con
Info
::




### Set up the PATH


By default, the Docker image runs the `archwayd` binary, so you should specify the arguments for `archwayd` right after the image name. For better usage, mount an external volume at `/root/.archway` to persist the daemon home path across different runs. For example, if you want to add a key:

::highlight-card
Expand Down Expand Up @@ -388,8 +372,6 @@ Info
After setting the alias with the above tip, you can use the other **archwayd** commands without typing the verbose Docker run command.
For the sake of comprehensive documentation, the full Docker command is shown. Just remember that by setting the alias you can simply use **archwayd** instead of the Docker command.



## Node.js and Npm

**npm** is a package manager for JavaScript and Node.js. Archway uses **npm** for installing and updating the developer CLI.
Expand All @@ -406,7 +388,7 @@ Info

## Archway Developer CLI

Install the Archway developer CLI using <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" target="_blank" >npm</a>.
Install the Archway developer CLI using <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm" target="_blank" >npm</a>.
::highlight-card

```bash
Expand Down
10 changes: 4 additions & 6 deletions content/2.developers/3.guides/3.my-first-dapp/2.wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ After having built and tested the project, it is important that to test the dapp

For that, you need the **wasm32-unknown-unknown** target installed in the toolchain as well. See the [Installation Guide](/developers/getting-started/install#wasm32) to have this dependency installed.


There are two types of **wasm** binaries that can be produced by the Developer CLI. Let's call them _"default"_ **wasm** and _"CosmWasm"_ **wasm**.
There are two types of **wasm** binaries that can be produced by the Developer CLI. Let's call them _"default"_ **wasm** and _"CosmWasm"_ **wasm**.

## Default Wasm executables

Expand All @@ -23,8 +22,8 @@ Regular **wasm** binaries can be produced by running the Rust native command **c
```bash
cargo wasm
```
::

::

Example output:
::highlight-card
Expand All @@ -47,7 +46,7 @@ While it is good to know that the project will compile valid **wasm** files, the

_CosmWasm_ **wasm** executables are optimized using the **cosmwasm/rust-optimizer** which produces a smaller executable size than **cargo wasm**.

If you are coming from a **C++** background, it's like building executables with <a href="https://upx.github.io" target="_blank">UPX</a>, as **cosmwasm/rust-optimizer** also compresses the binary to produce smaller build outputs.
If you are coming from a **C++** background, it's like building executables with <a href="https://upx.github.io" target="_blank">UPX</a>, as **cosmwasm/rust-optimizer** also compresses the binary to produce smaller build outputs.

To build a _CosmWasm_ **wasm** executable, pass the **-optimize** flag to **archway build**.
::highlight-card
Expand All @@ -60,8 +59,7 @@ archway build --optimize

The rust-optimizer will make sure that the WASM binary is as small as possible in order to minimize fees and blockchain storage.
::alert{variant="info"}
To use the rust-optimizer you will need to have <a href=" https://docs.docker.com/engine/install/ubuntu/" target="_blank">Docker</a> installed.

To use the rust-optimizer you will need to have <a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank">Docker</a> installed.

#title
Info
Expand Down
15 changes: 13 additions & 2 deletions data/useNavigation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { computed, ComputedRef, Ref } from 'vue';
import jsonQ from 'js-jsonq';
import { Section } from '@/data';
import { NavigationItem } from '@/domain';

Expand All @@ -9,11 +10,21 @@ export const useNavigation: (section: Section) => Promise<{
const query = queryContent()
.where({ _path: { $contains: section.path || '' } })
.where({ parentSection: { $ne: '' } });
const { data, pending } = await useAsyncData(`navigation-${section.id}`, () => fetchContentNavigation(query));
const { data, pending } = await useAsyncData(`navigation-${section.id}`, () => fetchContentNavigation());

const navigation = computed(() => {
return ((data.value || [])?.[0]?.children || []).map(item => NavigationItem.make(item));
const q = new jsonQ(data.value || []);
const parent = q.whereContains('_path', section.path).where('parentSection', '=', '').first();
return new jsonQ(parent || { children: [] })
.from('children')
.where('_path', '!=', section.path)
.fetch()
.map((item: any) => NavigationItem.make(item));
});

// const navigation = computed(() => {
// return ((xxx.value || [])?.[0]?.children || []).map(item => NavigationItem.make(item));
// });

return { navigation, isLoading: computed(() => pending.value) };
};
13 changes: 13 additions & 0 deletions middleware/redirects.global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const redirects: Record<string, string> = {
'/overview': '/overview/about',
'/resources': '/resources/networks',
'/validators/running-a-node': '/validators/running-a-node/prerequisites',
'/validators/requirements': '/validators/becoming-a-validator/requirements',
'/community/wallet-setup/keplr-setup': '/community/wallet-setup/keplr/keplr-setup',
};

export default defineNuxtRouteMiddleware(to => {
if (Object.keys(redirects).includes(to.path)) {
return navigateTo(redirects[to.path]);
}
});
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default defineNuxtConfig({
{
children: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-54W7BX3');`,
type: 'text/javascript',
charset: 'utf-8',
},
],
noscript: [
Expand Down Expand Up @@ -123,6 +122,7 @@ export default defineNuxtConfig({
sitemap: {
hostname: 'https://docs.archway.io',
},
ssr: true,
nitro: {
preset: 'firebase',
prerender: {
Expand Down
Loading

0 comments on commit b832f21

Please sign in to comment.