From c196bc618950801d88b315ee98c60c3d16ce9487 Mon Sep 17 00:00:00 2001
From: Sarah Schwartz <58856580+sarahschwartz@users.noreply.github.com>
Date: Thu, 26 Oct 2023 10:20:11 -0600
Subject: [PATCH] refactor: use variables for testnet & faucet (#96)
---
docs/guides/docs/installation/index.mdx | 51 +++++-----
.../docs/quickstart/building-a-frontend.mdx | 2 +-
.../quickstart/building-a-smart-contract.mdx | 12 ++-
.../running-a-node/running-a-beta-4-node.mdx | 86 ++++++++++++-----
package.json | 6 +-
pnpm-lock.yaml | 94 ++++++++++---------
scripts/generate-links/getDocs.mjs | 2 +-
spell-check-custom-words.txt | 6 +-
src/components/MDXRender.tsx | 20 +++-
src/components/VersionDropdown.tsx | 15 +--
src/config/constants.ts | 7 +-
src/hooks/useVersion.tsx | 13 ++-
src/lib/plugins/code-import.ts | 9 +-
src/lib/plugins/rehype-code.ts | 5 +-
src/lib/plugins/text-import.ts | 4 +
src/pages/[...slug].tsx | 1 +
src/screens/HomePage.tsx | 3 +-
17 files changed, 216 insertions(+), 120 deletions(-)
diff --git a/docs/guides/docs/installation/index.mdx b/docs/guides/docs/installation/index.mdx
index d18a36015..57e3d9bf3 100644
--- a/docs/guides/docs/installation/index.mdx
+++ b/docs/guides/docs/installation/index.mdx
@@ -45,7 +45,8 @@ toolchains and keep them updated. It makes building and maintaining Sway applica
### Running `fuelup-init`
{/*install_fuelup:example:start*/}
-To install the Fuel toolchain, you'll use the `fuelup-init` script. This will install `forc`, `forc-client`, `forc-fmt`, `forc-lsp`, `forc-wallet` as well as `fuel-core` in `~/.fuelup/bin`.
+To install the Fuel toolchain, you'll use the `fuelup-init` script.
+This will install `forc`, `forc-client`, `forc-fmt`, `forc-lsp`, `forc-wallet` as well as `fuel-core` in `~/.fuelup/bin`.
{/*install_fuelup:example:end*/}
👉 Just paste the following line in your terminal and press *Enter*.
@@ -62,7 +63,8 @@ curl --proto '=https' --tlsv1.2 -sSf https://install.fuel.network/fuelup-init.sh
### Setup PATH
-Once the script is downloaded, it will be executed automatically. The `fuelup-init` script will prompt you with the question below:
+Once the script is downloaded, it will be executed automatically.
+The `fuelup-init` script will prompt you with the question below:
```sh
fuelup uses "/home/username/.fuelup" as its home directory to manage the Fuel toolchain, and will install binaries there.
@@ -107,7 +109,8 @@ fuelup 0.19.5
Just as in [Rust](https://rust-lang.github.io/rustup/concepts/toolchains.html), Fuel supports multiple toolchains. A toolchain is a collection of tools (such as the compiler, LSP, etc).
By default, `fuelup` includes a series of packages tested to work with each other, providing a reliable set of tools.
-In this case, we will install the `beta-4` toolchain, which is the stable toolchain compatible with the beta-4 network. For more information on `beta-4` check the [Fuel blog](https://fuel-labs.ghost.io/announcing-beta-4-testnet/) page.
+In this case, we will install the {props.fuelTestnetInlineCode} toolchain, which is the stable toolchain compatible with the {props.fuelTestnetInlineCode} network.
+For more information on {props.fuelTestnetInlineCode} check the [Fuel blog](https://fuel-labs.ghost.io/announcing-beta-4-testnet/) page.
### Updating fuelup
@@ -128,23 +131,24 @@ Unpacking and moving fuelup to /var/folders/tp/0l8zdx9j4s9_n609ykwxl0qw0000gn/T/
Moving /var/folders/tp/0l8zdx9j4s9_n609ykwxl0qw0000gn/T/.tmpiNJQHt/fuelup to /Users/.fuelup/bin/fuelup
```
-### Installing the beta-4 toolchain
+### Installing the {props.fuelTestnet} toolchain
-The `beta-4` network is the latest Fuel testnet. This includes public infrastructure such as the [Beta-4 faucet](https://faucet-beta-4.fuel.network/) and the [Beta-4 GraphQL endpoint](https://beta-4.fuel.network/playground).
+The {props.fuelTestnetInlineCode} network is the latest Fuel testnet.
+This includes public infrastructure such as the {props.faucetLink} and the {props.GQLPlaygroundLink}.
-To properly interact with the `beta-4` network it is necessary to use its corresponding toolchain.
+To properly interact with the {props.fuelTestnetInlineCode} network it is necessary to use its corresponding toolchain.
-{/*install_beta-4:example:start*/}
-👉 Run the following command to install the `beta-4` toolchain:
-{/*install_beta-4:example:end*/}
+{/*install_testnet:example:start*/}
+👉 Run the following command to install the {props.fuelTestnetInlineCode} toolchain:
+{/*install_testnet:example:end*/}
-{/*install_beta-4_command:example:start*/}
+{/*install_testnet_command:example:start*/}
```console
-fuelup toolchain install beta-4
+fuelup toolchain install {props.fuelTestnet}
```
-{/*install_beta-4_command:example:end*/}
+{/*install_testnet_command:example:end*/}
If the toolchain was successfully installed, you will see this output:
@@ -152,29 +156,30 @@ If the toolchain was successfully installed, you will see this output:
The Fuel toolchain is installed and up to date
```
-The toolchain was installed correctly, however is not in use yet. Next, you need to configure `fuelup` to use the `beta-4` toolchain as the default.
+The toolchain was installed correctly, however is not in use yet. Next, you need to configure `fuelup` to use the {props.fuelTestnetInlineCode} toolchain as the default.
-{/*set_default_beta-4:example:start*/}
-👉 Set `beta-4` as your default toolchain with the following command:
-{/*set_default_beta-4:example:end*/}
+{/*set_default_testnet:example:start*/}
+👉 Set {props.fuelTestnetInlineCode} as your default toolchain with the following command:
+{/*set_default_testnet:example:end*/}
-{/*set_default_beta-4_command:example:start*/}
+{/*set_default_testnet_command:example:start*/}
```console
-fuelup default beta-4
+fuelup default {props.fuelTestnet}
```
-{/*set_default_beta-4_command:example:end*/}
+{/*set_default_testnet_command:example:end*/}
-You will get the following output indicating that you have successfully set `beta-4` as your default toolchain.
+You will get the following output indicating that you have successfully set {props.fuelTestnetInlineCode} as your default toolchain.
```console
-default toolchain set to 'beta-4'
+default toolchain set to '{props.fuelTestnet}'
```
### Checking your current toolchain
-Sometimes you might end up using multiple toolchains at once. Don't worry if you get confused about which toolchain you are using, since you can check your current toolchain anytime.
+Sometimes you might end up using multiple toolchains at once.
+Don't worry if you get confused about which toolchain you are using, since you can check your current toolchain anytime.
👉 Run the `fuelup show` command to see the toolchain and the versions of each tool you are using.
@@ -209,7 +214,7 @@ forc : 0.45
forc-wallet : 0.45
```
-As you can see, the beta-4 toolchain is active 🚀
+As you can see, the {props.fuelTestnetInlineCode} toolchain is active 🚀
## What's next?
diff --git a/docs/guides/docs/quickstart/building-a-frontend.mdx b/docs/guides/docs/quickstart/building-a-frontend.mdx
index b157cfc15..44d2103fb 100644
--- a/docs/guides/docs/quickstart/building-a-frontend.mdx
+++ b/docs/guides/docs/quickstart/building-a-frontend.mdx
@@ -26,7 +26,7 @@ Before going to the next steps, install the Fuel Wallet [here](https://chrome.go
If you have previously installed the wallet, make sure you have updated to the latest version.
-Once you've installed the wallet, take the address of your wallet and use it to get some coins from [the testnet faucet](https://faucet-beta-4.fuel.network/).
+Once you've installed the wallet, take the address of your wallet and use it to get some coins from the {props.faucetLink}.
## Initialize a React project
diff --git a/docs/guides/docs/quickstart/building-a-smart-contract.mdx b/docs/guides/docs/quickstart/building-a-smart-contract.mdx
index 78d9e003d..55544ed67 100644
--- a/docs/guides/docs/quickstart/building-a-smart-contract.mdx
+++ b/docs/guides/docs/quickstart/building-a-smart-contract.mdx
@@ -40,13 +40,13 @@ parent:
+{/*install_help:example:start*/}
For more detailed instructions on installing `fuelup`, visit the [installation guide](/guides/installation).
> Having problems with this part? Post your question on our [forum](https://forum.fuel.network/). To help you as efficiently as possible, include the output of this command in your post: `fuelup show.`
+{/*install_help:example:end*/}
## Your First Sway Project
@@ -475,7 +477,7 @@ forc wallet accounts
### Get Testnet Coins
-With your account address in hand, head to the [testnet faucet](https://faucet-beta-4.fuel.network/) to get some coins sent to your wallet.
+With your account address in hand, head to the {props.faucetLink} to get some coins sent to your wallet.
### Deploy To Testnet
diff --git a/docs/guides/docs/running-a-node/running-a-beta-4-node.mdx b/docs/guides/docs/running-a-node/running-a-beta-4-node.mdx
index 9ee721d57..246fc44ad 100644
--- a/docs/guides/docs/running-a-node/running-a-beta-4-node.mdx
+++ b/docs/guides/docs/running-a-node/running-a-beta-4-node.mdx
@@ -10,31 +10,67 @@ parent:
## Installation
-{/*This example should include the instructions for installing Rust & Fuelup*/}
-{/*installation:example:start*/}
-Start by [installing the Rust toolchain](https://www.rust-lang.org/tools/install).
-
-Then, [install the Fuel toolchain](/docs/fuelup/installation).
-{/*installation:example:end*/}
-
-{/*This example should include the instructions for installing the latest toolchain*/}
-{/*toolchain_installation:example:start*/}
-Make sure you have the latest version of `fuelup` by running the following command:
-
-```console
-fuelup self update
-```
-
-Then run `fuelup toolchain install beta-4` to install the `beta-4` toolchain.
-
-Finally, set the `beta-4` toolchain as your default distribution with the following command:
-
-```sh
-$ fuelup default beta-4
-default toolchain set to 'beta-4-aarch64-apple-darwin'
-```
-
-You can check your current toolchain anytime by running `fuelup show` to ensure you have `fuel-core 0.20.4`.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## Getting a Sepolia (Ethereum Testnet) API Key
diff --git a/package.json b/package.json
index 334e76470..f8b6a2bf3 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,8 @@
"test:guides": "npx playwright test tests/test.spec.ts",
"test:guides:debug": "DEBUG=pw:api npx playwright test tests/test.spec.ts",
"ts:check": "tsc --noEmit",
- "update-latest-docs": "sh ./scripts/update-latest-submodules.sh"
+ "lint:guides:check": "markdownlint --config .markdownlint.yaml --ignore-path .markdownlintignore '**/*.mdx'",
+ "lint:guides:fix": "markdownlint --config .markdownlint.yaml --ignore-path .markdownlintignore '**/*.mdx' --fix"
},
"dependencies": {
"@actions/exec": "^1.1.1",
@@ -113,7 +114,8 @@
"@adobe/css-tools@<4.3.1": ">=4.3.1",
"graphql@>=16.3.0 <16.8.1": ">=16.8.1",
"postcss@<8.4.31": ">=8.4.31",
- "zod@<=3.22.2": ">=3.22.3"
+ "zod@<=3.22.2": ">=3.22.3",
+ "next@<13.4.20-canary.13": ">=13.4.20-canary.13"
}
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6cce30d1a..b34c8787d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,6 +11,7 @@ overrides:
graphql@>=16.3.0 <16.8.1: '>=16.8.1'
postcss@<8.4.31: '>=8.4.31'
zod@<=3.22.2: '>=3.22.3'
+ next@<13.4.20-canary.13: '>=13.4.20-canary.13'
dependencies:
'@actions/exec':
@@ -113,11 +114,11 @@ dependencies:
specifier: ^0.37.0
version: 0.37.0
next:
- specifier: 13.4.19
- version: 13.4.19(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0)
+ specifier: '>=13.4.20-canary.13'
+ version: 13.5.6(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0)
next-contentlayer:
specifier: ^0.3.4
- version: 0.3.4(contentlayer@0.3.4)(esbuild@0.19.2)(next@13.4.19)(react-dom@18.2.0)(react@18.2.0)
+ version: 0.3.4(contentlayer@0.3.4)(esbuild@0.19.2)(next@13.5.6)(react-dom@18.2.0)(react@18.2.0)
node-html-markdown:
specifier: ^1.3.0
version: 1.3.0
@@ -1742,8 +1743,8 @@ packages:
react: 18.2.0
dev: false
- /@next/env@13.4.19:
- resolution: {integrity: sha512-FsAT5x0jF2kkhNkKkukhsyYOrRqtSxrEhfliniIq0bwWbuXLgyt3Gv0Ml+b91XwjwArmuP7NxCiGd++GGKdNMQ==}
+ /@next/env@13.5.6:
+ resolution: {integrity: sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==}
dev: false
/@next/eslint-plugin-next@13.4.19:
@@ -1751,8 +1752,8 @@ packages:
dependencies:
glob: 7.1.7
- /@next/swc-darwin-arm64@13.4.19:
- resolution: {integrity: sha512-vv1qrjXeGbuF2mOkhkdxMDtv9np7W4mcBtaDnHU+yJG+bBwa6rYsYSCI/9Xm5+TuF5SbZbrWO6G1NfTh1TMjvQ==}
+ /@next/swc-darwin-arm64@13.5.6:
+ resolution: {integrity: sha512-5nvXMzKtZfvcu4BhtV0KH1oGv4XEW+B+jOfmBdpFI3C7FrB/MfujRpWYSBBO64+qbW8pkZiSyQv9eiwnn5VIQA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
@@ -1760,8 +1761,8 @@ packages:
dev: false
optional: true
- /@next/swc-darwin-x64@13.4.19:
- resolution: {integrity: sha512-jyzO6wwYhx6F+7gD8ddZfuqO4TtpJdw3wyOduR4fxTUCm3aLw7YmHGYNjS0xRSYGAkLpBkH1E0RcelyId6lNsw==}
+ /@next/swc-darwin-x64@13.5.6:
+ resolution: {integrity: sha512-6cgBfxg98oOCSr4BckWjLLgiVwlL3vlLj8hXg2b+nDgm4bC/qVXXLfpLB9FHdoDu4057hzywbxKvmYGmi7yUzA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
@@ -1769,8 +1770,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-arm64-gnu@13.4.19:
- resolution: {integrity: sha512-vdlnIlaAEh6H+G6HrKZB9c2zJKnpPVKnA6LBwjwT2BTjxI7e0Hx30+FoWCgi50e+YO49p6oPOtesP9mXDRiiUg==}
+ /@next/swc-linux-arm64-gnu@13.5.6:
+ resolution: {integrity: sha512-txagBbj1e1w47YQjcKgSU4rRVQ7uF29YpnlHV5xuVUsgCUf2FmyfJ3CPjZUvpIeXCJAoMCFAoGnbtX86BK7+sg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -1778,8 +1779,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-arm64-musl@13.4.19:
- resolution: {integrity: sha512-aU0HkH2XPgxqrbNRBFb3si9Ahu/CpaR5RPmN2s9GiM9qJCiBBlZtRTiEca+DC+xRPyCThTtWYgxjWHgU7ZkyvA==}
+ /@next/swc-linux-arm64-musl@13.5.6:
+ resolution: {integrity: sha512-cGd+H8amifT86ZldVJtAKDxUqeFyLWW+v2NlBULnLAdWsiuuN8TuhVBt8ZNpCqcAuoruoSWynvMWixTFcroq+Q==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
@@ -1787,8 +1788,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-x64-gnu@13.4.19:
- resolution: {integrity: sha512-htwOEagMa/CXNykFFeAHHvMJeqZfNQEoQvHfsA4wgg5QqGNqD5soeCer4oGlCol6NGUxknrQO6VEustcv+Md+g==}
+ /@next/swc-linux-x64-gnu@13.5.6:
+ resolution: {integrity: sha512-Mc2b4xiIWKXIhBy2NBTwOxGD3nHLmq4keFk+d4/WL5fMsB8XdJRdtUlL87SqVCTSaf1BRuQQf1HvXZcy+rq3Nw==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -1796,8 +1797,8 @@ packages:
dev: false
optional: true
- /@next/swc-linux-x64-musl@13.4.19:
- resolution: {integrity: sha512-4Gj4vvtbK1JH8ApWTT214b3GwUh9EKKQjY41hH/t+u55Knxi/0wesMzwQRhppK6Ddalhu0TEttbiJ+wRcoEj5Q==}
+ /@next/swc-linux-x64-musl@13.5.6:
+ resolution: {integrity: sha512-CFHvP9Qz98NruJiUnCe61O6GveKKHpJLloXbDSWRhqhkJdZD2zU5hG+gtVJR//tyW897izuHpM6Gtf6+sNgJPQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
@@ -1805,8 +1806,8 @@ packages:
dev: false
optional: true
- /@next/swc-win32-arm64-msvc@13.4.19:
- resolution: {integrity: sha512-bUfDevQK4NsIAHXs3/JNgnvEY+LRyneDN788W2NYiRIIzmILjba7LaQTfihuFawZDhRtkYCv3JDC3B4TwnmRJw==}
+ /@next/swc-win32-arm64-msvc@13.5.6:
+ resolution: {integrity: sha512-aFv1ejfkbS7PUa1qVPwzDHjQWQtknzAZWGTKYIAaS4NMtBlk3VyA6AYn593pqNanlicewqyl2jUhQAaFV/qXsg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
@@ -1814,8 +1815,8 @@ packages:
dev: false
optional: true
- /@next/swc-win32-ia32-msvc@13.4.19:
- resolution: {integrity: sha512-Y5kikILFAr81LYIFaw6j/NrOtmiM4Sf3GtOc0pn50ez2GCkr+oejYuKGcwAwq3jiTKuzF6OF4iT2INPoxRycEA==}
+ /@next/swc-win32-ia32-msvc@13.5.6:
+ resolution: {integrity: sha512-XqqpHgEIlBHvzwG8sp/JXMFkLAfGLqkbVsyN+/Ih1mR8INb6YCc2x/Mbwi6hsAgUnqQztz8cvEbHJUbSl7RHDg==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
@@ -1823,8 +1824,8 @@ packages:
dev: false
optional: true
- /@next/swc-win32-x64-msvc@13.4.19:
- resolution: {integrity: sha512-YzA78jBDXMYiINdPdJJwGgPNT3YqBNNGhsthsDoWHL9p24tEJn9ViQf/ZqTbwSpX/RrkPupLfuuTH2sf73JBAw==}
+ /@next/swc-win32-x64-msvc@13.5.6:
+ resolution: {integrity: sha512-Cqfe1YmOS7k+5mGu92nl5ULkzpKuxJrP3+4AEuPmrpFZ3BHxTY3TnHmU1On3bFmFFs6FbTcdF58CCUProGpIGQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
@@ -4396,6 +4397,12 @@ packages:
tslib: 2.6.2
dev: false
+ /@swc/helpers@0.5.2:
+ resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==}
+ dependencies:
+ tslib: 2.6.2
+ dev: false
+
/@tabler/icons@2.33.0:
resolution: {integrity: sha512-cmVBeVANYGniLa0Q9gSUXU3SY0V9D3bfvHAq2bE+S0sdvnbMRNCHAmVQQv1lV6LT/aT7kzpwHAQz+6Iz1rPPsA==}
dev: false
@@ -5288,8 +5295,8 @@ packages:
tslib: 2.6.2
dev: false
- /caniuse-lite@1.0.30001525:
- resolution: {integrity: sha512-/3z+wB4icFt3r0USMwxujAqRvaD/B7rvGTsKhbhSQErVrJvkZCLhgNLJxU8MevahQVH6hCU9FsHdNUFbiwmE7Q==}
+ /caniuse-lite@1.0.30001553:
+ resolution: {integrity: sha512-N0ttd6TrFfuqKNi+pMgWJTb9qrdJu4JSpgPFLe/lrD19ugC6fZgF0pUewRowDwzdDnb9V41mFcdlYgl/PyKf4A==}
dev: false
/ccount@2.0.1:
@@ -8677,18 +8684,18 @@ packages:
engines: {node: '>= 0.4.0'}
dev: false
- /next-contentlayer@0.3.4(contentlayer@0.3.4)(esbuild@0.19.2)(next@13.4.19)(react-dom@18.2.0)(react@18.2.0):
+ /next-contentlayer@0.3.4(contentlayer@0.3.4)(esbuild@0.19.2)(next@13.5.6)(react-dom@18.2.0)(react@18.2.0):
resolution: {integrity: sha512-UtUCwgAl159KwfhNaOwyiI7Lg6sdioyKMeh+E7jxx0CJ29JuXGxBEYmCI6+72NxFGIFZKx8lvttbbQhbnYWYSw==}
peerDependencies:
contentlayer: 0.3.4
- next: ^12 || ^13
+ next: '>=13.4.20-canary.13'
react: '*'
react-dom: '*'
dependencies:
'@contentlayer/core': 0.3.4(esbuild@0.19.2)
'@contentlayer/utils': 0.3.4
contentlayer: 0.3.4(esbuild@0.19.2)
- next: 13.4.19(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0)
+ next: 13.5.6(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0)
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
transitivePeerDependencies:
@@ -8698,9 +8705,9 @@ packages:
- supports-color
dev: false
- /next@13.4.19(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0):
- resolution: {integrity: sha512-HuPSzzAbJ1T4BD8e0bs6B9C1kWQ6gv8ykZoRWs5AQoiIuqbGHHdQO7Ljuvg05Q0Z24E2ABozHe6FxDvI6HfyAw==}
- engines: {node: '>=16.8.0'}
+ /next@13.5.6(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0):
+ resolution: {integrity: sha512-Y2wTcTbO4WwEsVb4A8VSnOsG1I9ok+h74q0ZdxkwM3EODqrs4pasq7O0iUxbcS9VtWMicG7f3+HAj0r1+NtKSw==}
+ engines: {node: '>=16.14.0'}
hasBin: true
peerDependencies:
'@opentelemetry/api': ^1.1.0
@@ -8713,27 +8720,26 @@ packages:
sass:
optional: true
dependencies:
- '@next/env': 13.4.19
+ '@next/env': 13.5.6
'@opentelemetry/api': 1.4.1
- '@swc/helpers': 0.5.1
+ '@swc/helpers': 0.5.2
busboy: 1.6.0
- caniuse-lite: 1.0.30001525
+ caniuse-lite: 1.0.30001553
postcss: 8.4.31
react: 18.2.0
react-dom: 18.2.0(react@18.2.0)
styled-jsx: 5.1.1(react@18.2.0)
watchpack: 2.4.0
- zod: 3.22.3
optionalDependencies:
- '@next/swc-darwin-arm64': 13.4.19
- '@next/swc-darwin-x64': 13.4.19
- '@next/swc-linux-arm64-gnu': 13.4.19
- '@next/swc-linux-arm64-musl': 13.4.19
- '@next/swc-linux-x64-gnu': 13.4.19
- '@next/swc-linux-x64-musl': 13.4.19
- '@next/swc-win32-arm64-msvc': 13.4.19
- '@next/swc-win32-ia32-msvc': 13.4.19
- '@next/swc-win32-x64-msvc': 13.4.19
+ '@next/swc-darwin-arm64': 13.5.6
+ '@next/swc-darwin-x64': 13.5.6
+ '@next/swc-linux-arm64-gnu': 13.5.6
+ '@next/swc-linux-arm64-musl': 13.5.6
+ '@next/swc-linux-x64-gnu': 13.5.6
+ '@next/swc-linux-x64-musl': 13.5.6
+ '@next/swc-win32-arm64-msvc': 13.5.6
+ '@next/swc-win32-ia32-msvc': 13.5.6
+ '@next/swc-win32-x64-msvc': 13.5.6
transitivePeerDependencies:
- '@babel/core'
- babel-plugin-macros
diff --git a/scripts/generate-links/getDocs.mjs b/scripts/generate-links/getDocs.mjs
index 71f845395..302205773 100644
--- a/scripts/generate-links/getDocs.mjs
+++ b/scripts/generate-links/getDocs.mjs
@@ -163,7 +163,7 @@ export async function getDocs(key, order) {
case 'guides':
paths = [
// GUIDES
- './guides/**/*.mdx',
+ './guides/docs/**/*.mdx',
];
break;
// case 'latest-guides':
diff --git a/spell-check-custom-words.txt b/spell-check-custom-words.txt
index 969b50375..1f9041a02 100644
--- a/spell-check-custom-words.txt
+++ b/spell-check-custom-words.txt
@@ -52,4 +52,8 @@ stateful
runnable
CLI
dev
-TODO
\ No newline at end of file
+TODO
+fuelTestnetInlineCode
+fuelTestnet
+faucetLink
+GQLPlaygroundLink
\ No newline at end of file
diff --git a/src/components/MDXRender.tsx b/src/components/MDXRender.tsx
index 2d4e5c489..9cc5422db 100644
--- a/src/components/MDXRender.tsx
+++ b/src/components/MDXRender.tsx
@@ -6,6 +6,11 @@ import * as provider from '@mdx-js/react';
import dynamic from 'next/dynamic';
import { useMemo } from 'react';
+import {
+ FAUCET_LINK,
+ FUEL_TESTNET,
+ PLAYGROUND_LINK,
+} from '../config/constants';
import { runtime } from '../lib/runtime';
import { Blockquote } from './Blockquote';
@@ -55,7 +60,20 @@ export function MDXRender({ code, components }: MDXRenderProps) {
return (
-
+ {FUEL_TESTNET}}
+ faucetLink={
+
+ {FUEL_TESTNET}
faucet
+
+ }
+ GQLPlaygroundLink={
+
+ {FUEL_TESTNET}
graphQL playground
+
+ }
+ />
);
}
diff --git a/src/components/VersionDropdown.tsx b/src/components/VersionDropdown.tsx
index 0fac63f80..c23afea96 100644
--- a/src/components/VersionDropdown.tsx
+++ b/src/components/VersionDropdown.tsx
@@ -3,6 +3,7 @@ import { Dropdown, Text, Icon } from '@fuel-ui/react';
import { useRouter } from 'next/router';
import { useState } from 'react';
+import { FUEL_TESTNET, FUEL_TESTNET_UPPER_CASE } from '../config/constants';
import { useSetVersion } from '../hooks/useVersion';
export default function VersionDropdown({ isLatest }: { isLatest: boolean }) {
@@ -22,16 +23,16 @@ export default function VersionDropdown({ isLatest }: { isLatest: boolean }) {
opened ? { ...styles.trigger, ...styles.triggerOpen } : styles.trigger
}
>
- Version: {isLatest ? 'Latest' : 'Beta-4'}
+ Version: {isLatest ? 'Latest' : FUEL_TESTNET_UPPER_CASE}
{
if (setVersion) {
- if (action === 'beta-4') {
- setVersion('Beta-4');
+ if (action === FUEL_TESTNET) {
+ setVersion(FUEL_TESTNET_UPPER_CASE);
} else if (action === 'latest') {
setVersion('Latest');
}
@@ -51,10 +52,10 @@ export default function VersionDropdown({ isLatest }: { isLatest: boolean }) {
>
- Beta-4
+ {FUEL_TESTNET_UPPER_CASE}
{!isLatest && }
diff --git a/src/config/constants.ts b/src/config/constants.ts
index 3b0d67e63..4779eafd9 100644
--- a/src/config/constants.ts
+++ b/src/config/constants.ts
@@ -4,6 +4,11 @@ export const DOCS_DIRECTORY = join(process.cwd(), './docs');
export const LATEST_DOCS_DIRECTORY = join(process.cwd(), './docs/latest');
export const FIELDS = ['title', 'slug', 'content', 'category'];
+export const FUEL_TESTNET = 'beta-4';
+export const FUEL_TESTNET_UPPER_CASE = 'Beta-4';
+export const FAUCET_LINK = `https://faucet-${FUEL_TESTNET}.fuel.network/`;
+export const PLAYGROUND_LINK = `https://${FUEL_TESTNET}.fuel.network/playground/`;
+
export type Tabs =
| 'home'
| 'guides'
@@ -166,7 +171,7 @@ export const NAVIGATION: LinkObject[] = [
{
name: 'Faucet',
type: 'external-link',
- link: 'https://faucet-beta-4.fuel.network/',
+ link: FAUCET_LINK,
},
{
name: 'Bridge',
diff --git a/src/hooks/useVersion.tsx b/src/hooks/useVersion.tsx
index 7c1df9f31..98b39da29 100644
--- a/src/hooks/useVersion.tsx
+++ b/src/hooks/useVersion.tsx
@@ -1,9 +1,11 @@
import type { ReactNode, FC } from 'react';
import { createContext, useContext, useState } from 'react';
-export type VersionCtx = 'Beta-4' | 'Latest';
+import { FUEL_TESTNET_UPPER_CASE } from '../config/constants';
-const versionCtx = createContext('Beta-4');
+export type VersionCtx = typeof FUEL_TESTNET_UPPER_CASE | 'Latest';
+
+const versionCtx = createContext(FUEL_TESTNET_UPPER_CASE);
const setVersionCtx = createContext<(value: VersionCtx) => void>(() => {});
export function useVersion() {
@@ -21,9 +23,12 @@ interface VersionProviderProps {
export const VersionProvider: FC = ({ children }) => {
const [state, setState] = useState(() => {
if (typeof window !== 'undefined') {
- return (sessionStorage.getItem('version') as VersionCtx) || 'Beta-4';
+ return (
+ (sessionStorage.getItem('version') as VersionCtx) ||
+ FUEL_TESTNET_UPPER_CASE
+ );
}
- return 'Beta-4';
+ return FUEL_TESTNET_UPPER_CASE;
});
const setVersionInSession = (version: VersionCtx) => {
diff --git a/src/lib/plugins/code-import.ts b/src/lib/plugins/code-import.ts
index ee86014cd..b838cbd7d 100644
--- a/src/lib/plugins/code-import.ts
+++ b/src/lib/plugins/code-import.ts
@@ -8,6 +8,7 @@ import path from 'path';
import * as prettier from 'prettier';
import type { Root } from 'remark-gfm';
import { visit } from 'unist-util-visit';
+import { FUEL_TESTNET } from '~/src/config/constants';
import { getEndCommentType } from './text-import';
import type { CommentTypes } from './text-import';
@@ -76,8 +77,10 @@ function extractCommentBlock(
}
if (trim === 'true') {
- lineStart = lineStart + 1;
- lineEnd = lineEnd - 1;
+ const startShift = lines[lineStart + 1].includes('```') ? 2 : 1;
+ const endShift = lines[lineEnd - 2].includes('```') ? 2 : 1;
+ lineStart = lineStart + startShift;
+ lineEnd = lineEnd - endShift;
}
if (lineStart < 0) {
@@ -209,6 +212,8 @@ export function codeImport() {
content = fileContent;
}
+ content = content.replaceAll('{props.fuelTestnet}', FUEL_TESTNET);
+
const newAttrs = [
{
name: '__content',
diff --git a/src/lib/plugins/rehype-code.ts b/src/lib/plugins/rehype-code.ts
index db64e0c23..ec90a272f 100644
--- a/src/lib/plugins/rehype-code.ts
+++ b/src/lib/plugins/rehype-code.ts
@@ -10,6 +10,7 @@ import type { Root } from 'remark-gfm';
import { getHighlighter as shikiGetHighlighter } from 'shiki';
import type { PluggableList } from 'unified';
import { visit } from 'unist-util-visit';
+import { FUEL_TESTNET } from '~/src/config/constants';
// Shiki loads languages and themes using "fs" instead of "import", so Next.js
// doesn't bundle them into production build. To work around, we manually copy
@@ -213,7 +214,7 @@ function getGraphQLCodeTabs(node: any) {
const apolloImport = `import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
const apolloClient= new ApolloClient({
- uri: 'https://beta-4.fuel.network/graphql',
+ uri: 'https://${FUEL_TESTNET}.fuel.network/graphql',
cache: new InMemoryCache(),
});\n\n`;
const apolloContentValue = apolloImport + apolloContent?.value ?? '';
@@ -222,7 +223,7 @@ function getGraphQLCodeTabs(node: any) {
const urlqImport = `import { createClient } from 'urql';
const urqlClient= createClient({
- url: 'https://beta-4.fuel.network/graphql',
+ url: 'https://${FUEL_TESTNET}.fuel.network/graphql',
});\n\n`;
const urlQContentValue = urlqImport + urqlContent?.value ?? '';
const urlQRaw = prettier.format(urlQContentValue, prettierProps);
diff --git a/src/lib/plugins/text-import.ts b/src/lib/plugins/text-import.ts
index 6460cfb73..d485f4f12 100644
--- a/src/lib/plugins/text-import.ts
+++ b/src/lib/plugins/text-import.ts
@@ -7,6 +7,7 @@ import { remark } from 'remark';
import type { Root } from 'remark-gfm';
import { visit } from 'unist-util-visit';
import type { Parent } from 'unist-util-visit/lib';
+import { FUEL_TESTNET } from '~/src/config/constants';
export type CommentTypes = '