Skip to content

Commit b5d064d

Browse files
committed
starting write builder documentation
1 parent 05f5c88 commit b5d064d

File tree

11 files changed

+280
-9
lines changed

11 files changed

+280
-9
lines changed

docs/documentation/app/builder/getting-started/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131

3232
MANAGER_TEMPLATES: process.env.MANAGER_TEMPLATES,
3333
MANAGER_MAX_PARALLEL_JOBS: process.env.MANAGER_MAX_PARALLEL_JOBS || 2,
34-
MANAGER_ALLOWED_DOMAINS: process.env.MANAGER_ALLOWED_DOMAINS,
34+
MANAGER_ALLOWED_DOMAINS: process.env.MANAGER_ALLOWED_DOMAINS || 'localhost:5001',
3535

3636
AUTH_MODE: process.env.AUTH_MODE || 'NO_AUTH',
3737
OTOROSHI_TOKEN_SECRET: process.env.OTOROSHI_TOKEN_SECRET || 'veryverysecret',

docs/documentation/app/builder/overview/page.mdx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,47 @@ import Github from '@/components/github';
44

55
This section provides detailed documentation for working with the builder.
66
<br />
7+
8+
# What is Wasmo Builder ?
9+
10+
Wasmo Builder is an all-in-one builder for creating, editing and building **small** and **optimized** WASM binaries.
11+
12+
# Key Features
13+
14+
- `Variety of languages`: Write plugins in your favorite language, Javascript, Typescript, Rust, Golang or Open Policy Agent.
15+
- `Build in one click`: Click the hammer and start using your wasm in seconds
16+
- `Fast starter`: Deploy the builder in-memory
17+
18+
# Start your first builder
19+
20+
## Prerequisites
21+
22+
- `Docker`: A Docker-enabled system with proper Docker access
23+
24+
Choose a path to install Wasmo Builder:
25+
- `With a database`: Use a database to store generated Wasm binaries. Can use the Builder API for editing plugins.
26+
- `Without a database (in-memory)`: Store generated Wasm binaries on the file system. In this mode, the Builder API is unavailable but the CLI keeps running.
27+
28+
Run the following command in your terminal to start your builder using a S3 storage:
29+
30+
```
31+
docker network create wasmo-network
32+
docker run --name s3Server \
33+
-p 8000:8000 \
34+
-e SCALITY_ACCESS_KEY_ID=access_key \
35+
-e SCALITY_SECRET_ACCESS_KEY=secret \
36+
--net wasmo-network scality/s3server
37+
docker run -d --net wasmo-network \
38+
--name wasmo \
39+
-p 5001:5001 \
40+
-e "AUTH_MODE=NO_AUTH" \
41+
-e "AWS_ACCESS_KEY_ID=access_key" \
42+
-e "AWS_SECRET_ACCESS_KEY=secret" \
43+
-e "S3_FORCE_PATH_STYLE=true" \
44+
-e "S3_ENDPOINT=http://localhost:8000" \
45+
-e "S3_BUCKET=wasmo" \
46+
-e "STORAGE=DOCKER_S3" \
47+
maif/wasmo
48+
```
49+
50+
If all goes well, Wasmo should now be serving your builder on [http://localhost:5001/](http://localhost:5001/)

docs/documentation/components/Layout.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { MDXProvider } from '@mdx-js/react';
44
import { Heading } from './mdx/Heading';
55
import { Link } from './mdx/Link';
66
import { Sidebar } from './Sidebar';
7+
import { List } from './mdx/List';
8+
import { Misc } from './mdx/Misc';
79

810
function Layout({ children, next }) {
911
return <>
@@ -34,7 +36,10 @@ function Layout({ children, next }) {
3436
<MDXProvider components={{
3537
h1: Heading.H1,
3638
h2: Heading.H2,
37-
a: Link.a
39+
a: Link.a,
40+
ul: List.ul,
41+
code: Misc.code,
42+
pre: Misc.pre
3843
}}>
3944
{children}
4045
</MDXProvider>

docs/documentation/components/Sidebar.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const slugify = str => str.toString()
1818

1919
export function Sidebar() {
2020

21+
const customWindow = window || { location: "/" }
22+
2123
return <div className="flex h-screen flex-col justify-between border-e bg-white" style={{ minWidth: 250 }}>
2224
<div className="px-4 py-6 ps-0">
2325
{/* <span
@@ -30,15 +32,15 @@ export function Sidebar() {
3032
<li>
3133
<a
3234
href="/"
33-
className={`block rounded-lg ${color(window.location.pathname === "/")} px-4 py-2 text-sm font-medium text-gray-700`}
35+
className={`block rounded-lg ${color(customWindow.location.pathname === "/")} px-4 py-2 text-sm font-medium text-gray-700`}
3436
>
3537
Overview
3638
</a>
3739
</li>
3840

3941
{Object.entries(LINKS).map(([group, children]) => {
4042
return <li key={group} >
41-
<details className="group [&_summary::-webkit-details-marker]:hidden" open={window.location.pathname.startsWith(`/${slugify(group)}`)}>
43+
<details className="group [&_summary::-webkit-details-marker]:hidden" open={customWindow.location.pathname.startsWith(`/${slugify(group)}`)}>
4244
<summary
4345
className="flex cursor-pointer items-center justify-between rounded-lg px-4 py-2 text-gray-500 hover:bg-gray-100 hover:text-gray-700"
4446
>
@@ -68,7 +70,7 @@ export function Sidebar() {
6870
return <li key={child}>
6971
<a
7072
href={href}
71-
className={`block rounded-lg px-4 py-2 text-sm font-medium text-gray-500 hover:bg-gray-100 hover:text-gray-700 ${color(window.location.pathname === href)}`}
73+
className={`block rounded-lg px-4 py-2 text-sm font-medium text-gray-500 hover:bg-gray-100 hover:text-gray-700 ${color(customWindow.location.pathname === href)}`}
7274
>
7375
{child}
7476
</a>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const Heading = {
2-
H1: ({ children }) => <h1 className="text-2xl font-bold text-gray-900 sm:text-4xl my-2">{children}</h1>,
2+
H1: ({ children }) => <h1 className="text-2xl font-bold text-gray-900 sm:text-3xl mt-10 mb-5">{children}</h1>,
33
H2: ({ children }) => <h2 className="text-xl font-bold my-2">{children}</h2>,
44
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const Link = {
22
a: (props) => {
3-
return <a className="font-medium text-blue-600 dark:text-blue-500 hover:underline" href={props.href}>{props.children}</a>
3+
return <a className="font-medium text-blue-600 dark:text-blue-500 hover:underline" href={props.href} target="_blank">{props.children}</a>
44
}
55
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const List = {
2+
ul: (props) => <div className="p-2 px-9">
3+
<ul className="list-disc">{props.children}</ul>
4+
</div>
5+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
import { useEffect, useState } from 'react';
3+
import SyntaxHighlighter from 'react-syntax-highlighter'
4+
import rainbow from 'react-syntax-highlighter/dist/esm/styles/hljs/tomorrow-night-blue'
5+
6+
export const Misc = {
7+
code: props => <span className="font-bold">{props.children}</span>,
8+
pre: props => {
9+
const [copied, setCopied] = useState()
10+
11+
useEffect(() => {
12+
if (copied)
13+
setTimeout(() => {
14+
setCopied(false)
15+
}, 1200)
16+
}, [copied])
17+
18+
const codeString = props.children.props.children;
19+
20+
return <div className='overflow-hidden relative rounded-lg my-3'>
21+
<div className='flex items-center bg-purple-900 ps-3' style={{
22+
position: 'absolute',
23+
top: 0,
24+
left: 0,
25+
right: 0,
26+
height: '2rem',
27+
gap: '.25rem',
28+
}}>
29+
<div style={{ width: 10, height: 10, borderRadius: '50%' }} className='bg-gray-400' />
30+
<div style={{ width: 10, height: 10, borderRadius: '50%' }} className='bg-gray-400' />
31+
<div style={{ width: 10, height: 10, borderRadius: '50%' }} className='bg-gray-400' />
32+
</div>
33+
34+
<div className="absolute right-2 rounded-lg top-10 p-1 cursor-pointer hover:bg-gray-600"
35+
onClick={() => {
36+
if (navigator.clipboard && window.isSecureContext) {
37+
navigator.clipboard.writeText(codeString);
38+
setCopied(true)
39+
}
40+
}}
41+
style={{
42+
border: '1px solid #fff'
43+
}}>
44+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff"
45+
className="w-5 h-5">
46+
<path stroke-linecap="round" stroke-linejoin="round" d="M15.666 3.888A2.25 2.25 0 0013.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 01-.75.75H9a.75.75 0 01-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 01-2.25 2.25H6.75A2.25 2.25 0 014.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 011.927-.184" />
47+
</svg>
48+
</div>
49+
50+
{copied && <div className='absolute right-10 top-10 p-1 text-white'>Copied!</div>}
51+
52+
<SyntaxHighlighter language="bash" style={rainbow} customStyle={{
53+
padding: '2.5rem 12px 1rem'
54+
}}>
55+
{codeString}
56+
</SyntaxHighlighter>
57+
</div >
58+
}
59+
}

docs/documentation/components/mdx/ReactM

Whitespace-only changes.

docs/documentation/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"@types/mdx": "^2.0.9",
1616
"next": "14.0.1",
1717
"react": "^18",
18-
"react-dom": "^18"
18+
"react-dom": "^18",
19+
"react-syntax-highlighter": "^15.5.0"
1920
},
2021
"devDependencies": {
2122
"@tailwindcss/typography": "^0.5.10",

0 commit comments

Comments
 (0)