Skip to content

Commit

Permalink
fix: broken link & tools for scripts (#334)
Browse files Browse the repository at this point in the history
* fix: broken link & tools for scripts

* update tools in minimal-script

* move tools you need to a separate mdx file
  • Loading branch information
yfeng2824 committed May 14, 2024
1 parent 24c3fc7 commit 392c8d2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
15 changes: 4 additions & 11 deletions website/docs/getting-started/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: Quick Start (5min)

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import ScriptTools from "../script/_ScriptTools.mdx";

# Quick Start (5min)

Expand All @@ -18,7 +19,7 @@ OffCKB provides a one-line command to start a local blockchain (CKB Devnet) with
npm install -g @offckb/cli
```

:::note
:::info
Throughout this documentation, we use offckb/cli version **>=0.2.2**. You can always run the above command to update to the latest version.
:::

Expand Down Expand Up @@ -164,19 +165,11 @@ Once the server is up and running, you can view the dApp by visiting [localhost:
The boilerplate project for a full-stack CKB dApp comprises two main components:

- The frontend, which utilizes the CKB JavaScript framework, [Lumos](https://github.com/ckb-js/lumos).
- The Scripts, which leverages the [ckb-script-templates](https://github.com/nervosnetwork/ckb-script-templates).
- The Scripts, which leverage the [ckb-script-templates](https://github.com/cryptape/ckb-script-templates).

By default, the Next.js template comes with a simple Script `hello-world` under `contracts/hello-world/src/main.rs`.

:::note Tools You Need

- [git](https://git-scm.com/), [make](https://www.tutorialspoint.com/unix_commands/make.htm), [sed](https://www.gnu.org/software/sed/), [bash](https://www.gnu.org/software/bash/), [sha256sum](https://linux.die.net/man/1/sha256sum) and others Unix utilities.
- [Rust](https://www.rust-lang.org/) with `riscv64 target`: `rustup target add riscv64imac-unknown-none-elf`
- [Clang 16+](https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html)
- [Cargo-generate](https://github.com/cargo-generate/cargo-generate)

Check out the `ckb-script-templates` for more [details](https://github.com/cryptape/ckb-script-templates/blob/main/README.md#dependencies).
:::
<ScriptTools />

### Script-Related Commands

Expand Down
15 changes: 12 additions & 3 deletions website/docs/script/ScriptHeaders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ export const ScriptHeaders: ScriptHeadersType = {
make
</a>
,
<a
href="https://www.gnu.org/software/sed/"
target="_blank"
rel="noopener noreferrer"
>
sed
</a>
,
<a
href="https://www.gnu.org/software/bash/"
target="_blank"
Expand Down Expand Up @@ -67,7 +75,7 @@ export const ScriptHeaders: ScriptHeadersType = {
>
Clang 16+
</a>
{" sample installtion steps for selected platforms are:"}

<ul>
<li>
Debian / Ubuntu:{" "}
Expand All @@ -83,10 +91,11 @@ export const ScriptHeaders: ScriptHeadersType = {
Archlinux: <code>sudo pacman --noconfirm -Syu clang</code>
</li>
<li>
macOS: <code>brew install llvm@16</code>
MacOS (with <a href="https://brew.sh/">Homebrew</a>):{" "}
<code>brew install llvm@16</code>
</li>
<li>
Windows(with [Scoop](scoop install llvm yasm)):{" "}
Windows (with <a href="https://scoop.sh/">Scoop</a>):{" "}
<code>scoop install llvm yasm</code>
</li>
</ul>
Expand Down
16 changes: 16 additions & 0 deletions website/docs/script/_ScriptTools.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
:::info Tools You Need

- [git](https://git-scm.com/), [make](https://www.tutorialspoint.com/unix_commands/make.htm), [sed](https://www.gnu.org/software/sed/), [bash](https://www.gnu.org/software/bash/), [sha256sum](https://linux.die.net/man/1/sha256sum) and others Unix utilities.
- [Rust](https://www.rust-lang.org/) with `riscv64 target`: `rustup target add riscv64imac-unknown-none-elf`
- [Clang 16+](https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html)

- Debian / Ubuntu: ` wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo./llvm.sh 16 && rm llvm.sh`
- Fedora 39+: `sudo dnf -y install clang`
- Archlinux: `sudo pacman --noconfirm -Syu clang`
- MacOS (with [Homebrew](https://brew.sh/)): `brew install llvm@16`
- Windows (with [Scoop](https://scoop.sh/)): `scoop install llvm yasm`

- [Cargo-generate](https://github.com/cargo-generate/cargo-generate)

Check out the `ckb-script-templates` for more [details](https://github.com/cryptape/ckb-script-templates/blob/main/README.md#dependencies).
:::
8 changes: 2 additions & 6 deletions website/docs/script/a-minimal-script.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import ScriptHeaders from "./ScriptHeaders.tsx";
import TutorialHeader from "@components/TutorialHeader";
import ScriptTools from "./_ScriptTools.mdx";

# Tutorial: A Minimal Script

Expand Down Expand Up @@ -44,12 +45,7 @@ Below is a step-by-step guide, and you can also clone the full code example from

The first step is to create a new Script project. We use [ckb-script-templates](https://github.com/cryptape/ckb-script-templates) for this purpose. You will need the following dependencies:

- `git`, `make`, `sed`, `bash`, `sha256sum` and others Unix utilities
- `Rust` with `riscv64` target installed: `rustup target add riscv64imac-unknown-none-elf`
- `Clang 16+`
- `cargo-generate`: You can install this via `cargo install cargo-generate`

If you got any problems for these dependencies, refer to [readme](https://github.com/cryptape/ckb-script-templates?tab=readme-ov-file#dependencies) for install details.
<ScriptTools />

### Init a Script Project

Expand Down
8 changes: 2 additions & 6 deletions website/docs/script/js-script.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import ScriptHeaders from "./ScriptHeaders.tsx";
import TutorialHeader from "@components/TutorialHeader";
import ScriptTools from "./_ScriptTools.mdx";

# Tutorial: Run JavaScript Code on CKB

Expand Down Expand Up @@ -110,12 +111,7 @@ understanding.

The first step is to create a new Script project. We use [ckb-script-templates](https://github.com/cryptape/ckb-script-templates) for this purpose. You will need the following dependencies:

- `git`, `make`, `sed`, `bash`, `sha256sum` and others Unix utilities
- `Rust` with `riscv64` target installed: `rustup target add riscv64imac-unknown-none-elf`
- `Clang 16+`
- `cargo-generate`: You can install this via `cargo install cargo-generate`

If you encounter any problems with these dependencies, refer to the [ReadMe](https://github.com/cryptape/ckb-script-templates?tab=readme-ov-file#dependencies) for installation details.
<ScriptTools />

### Init a Script Project

Expand Down

0 comments on commit 392c8d2

Please sign in to comment.