Skip to content

Commit 3beb7bb

Browse files
committed
docs: move webnode build scripts to separate files for CI testing
Move all build scripts from webnode.mdx into separate script files under website/docs/developers/scripts/frontend/ for better maintainability and automated CI testing. The scripts are now imported and displayed using Docusaurus CodeBlock imports, ensuring they remain testable and synchronized with the documentation. Changes: - Create script files for webnode build, deploy, start, and Docker commands - Update webnode.mdx to import and display scripts using CodeBlock - Add webnode build script test to CI workflow
1 parent c92c4ef commit 3beb7bb

File tree

7 files changed

+59
-31
lines changed

7 files changed

+59
-31
lines changed

.github/workflows/test-docs-scripts-frontend.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ jobs:
9191
fi
9292
bash website/docs/developers/scripts/frontend/build-leaderboard.sh
9393
94+
- name: Test build webnode script
95+
run: |
96+
# Source nvm if available (Linux)
97+
if [ -n "$NVM_DIR" ] && [ -s "$NVM_DIR/nvm.sh" ]; then
98+
\. "$NVM_DIR/nvm.sh"
99+
fi
100+
bash website/docs/developers/scripts/frontend/build-webnode.sh
101+
94102
- name: Prepare for Cypress tests (Ubuntu 22.04)
95103
if: matrix.os == 'ubuntu-22.04'
96104
run: |

website/docs/developers/frontend/webnode.mdx

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ sidebar_position: 4
55
---
66

77
import CodeBlock from "@theme/CodeBlock";
8+
import BuildWebnode from "!!raw-loader!../scripts/frontend/build-webnode.sh";
9+
import StartWebnodeLocal from "!!raw-loader!../scripts/frontend/start-webnode-local.sh";
10+
import DeployWebnode from "!!raw-loader!../scripts/frontend/deploy-webnode.sh";
11+
import DockerBuildWebnode from "!!raw-loader!../scripts/frontend/docker-build-webnode.sh";
12+
import DockerRunWebnode from "!!raw-loader!../scripts/frontend/docker-run-webnode.sh";
813

914
# WebNode
1015

@@ -33,12 +38,9 @@ requirements.
3338

3439
Build the WebNode version of the frontend:
3540

36-
```bash
37-
cd frontend
38-
39-
# Build with WebNode configuration
40-
make build-webnode
41-
```
41+
<CodeBlock language="bash" title="scripts/frontend/build-webnode.sh">
42+
{BuildWebnode}
43+
</CodeBlock>
4244

4345
<!-- prettier-ignore-start -->
4446

@@ -57,24 +59,19 @@ WebAssembly module build is not included in these commands.
5759

5860
Start the WebNode development server:
5961

60-
```bash
61-
# Start WebNode locally
62-
make start-webnodelocal
63-
```
62+
<CodeBlock language="bash" title="scripts/frontend/start-webnode-local.sh">
63+
{StartWebnodeLocal}
64+
</CodeBlock>
6465

6566
Access the WebNode at `http://localhost:4200`
6667

6768
### Production Deployment
6869

6970
Deploy WebNode to a web server:
7071

71-
```bash
72-
# Build for production
73-
make build-webnode
74-
75-
# Deploy to static hosting
76-
cp -r dist/frontend/browser/* /var/www/webnode/
77-
```
72+
<CodeBlock language="bash" title="scripts/frontend/deploy-webnode.sh">
73+
{DeployWebnode}
74+
</CodeBlock>
7875

7976
## Docker deployment
8077

@@ -98,23 +95,15 @@ WebAssembly-based node operation:
9895

9996
### Build Docker image
10097

101-
```bash
102-
# Generate .env.docker with current git information (required for WASM build)
103-
frontend/docker/generate-docker-env.sh
104-
105-
# Build the Docker image (from project root)
106-
docker build -t mina-frontend -f frontend/Dockerfile .
107-
```
98+
<CodeBlock language="bash" title="scripts/frontend/docker-build-webnode.sh">
99+
{DockerBuildWebnode}
100+
</CodeBlock>
108101

109102
### Run with Docker
110103

111-
```bash
112-
# Run WebNode with webnode configuration
113-
# This enables WASM node functionality and downloads circuit files
114-
docker run -p 4200:80 \
115-
-e MINA_FRONTEND_ENVIRONMENT=webnode \
116-
mina-frontend
117-
```
104+
<CodeBlock language="bash" title="scripts/frontend/docker-run-webnode.sh">
105+
{DockerRunWebnode}
106+
</CodeBlock>
118107

119108
<!-- prettier-ignore-start -->
120109

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Build the WebNode version of the frontend
2+
cd frontend
3+
4+
# Build with WebNode configuration
5+
make build-webnode
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Deploy WebNode to a web server
2+
cd frontend
3+
4+
# Build for production
5+
make build-webnode
6+
7+
# Deploy to static hosting
8+
# Note: Adjust the destination path as needed for your hosting setup
9+
cp -r dist/frontend/browser/* /var/www/webnode/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Build Docker image for WebNode
2+
3+
# Generate .env.docker with current git information (required for WASM build)
4+
frontend/docker/generate-docker-env.sh
5+
6+
# Build the Docker image (from project root)
7+
docker build -t mina-frontend -f frontend/Dockerfile .
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Run WebNode with webnode configuration
2+
# This enables WASM node functionality and downloads circuit files
3+
docker run -p 4200:80 \
4+
-e MINA_FRONTEND_ENVIRONMENT=webnode \
5+
mina-frontend
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Start the WebNode development server
2+
cd frontend
3+
4+
# Start WebNode locally
5+
make start-webnodelocal

0 commit comments

Comments
 (0)