Skip to content

Commit 17b284d

Browse files
authored
added expo template example (#67)
1 parent 7f15c16 commit 17b284d

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

docs/template/examples/expo.mdx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: "Expo App"
3+
description: "Expo web app running in the sandbox using Node.js"
4+
---
5+
6+
Basic Expo app.
7+
8+
<Note>
9+
The development server runs on port 8081 as soon as the sandbox is ready.
10+
</Note>
11+
12+
<CodeGroup>
13+
```typescript JavaScript & TypeScript
14+
// template.ts
15+
import { defaultBuildLogger, waitForURL } from "e2b";
16+
17+
export const template = Template()
18+
.fromNodeImage()
19+
.setWorkdir("/home/user/expo-app")
20+
.runCmd("npx create-expo-app@latest . --yes")
21+
.runCmd("mv /home/user/expo-app/* /home/user/ && rm -rf /home/user/expo-app")
22+
.setWorkdir("/home/user")
23+
.setStartCmd("npx expo start", waitForURL("http://localhost:8081"));
24+
```
25+
26+
```python Python
27+
# template.py
28+
from e2b import Template, wait_for_url
29+
30+
template = (
31+
Template()
32+
.from_node_image()
33+
.set_workdir("/home/user/expo-app")
34+
.run_cmd("npx create-expo-app@latest . --yes")
35+
.run_cmd("mv /home/user/expo-app/* /home/user/ && rm -rf /home/user/expo-app")
36+
.set_workdir("/home/user")
37+
.set_start_cmd("npx expo start", wait_for_url('http://localhost:8081'))
38+
)
39+
```
40+
</CodeGroup>
41+
42+
<CodeGroup>
43+
```typescript JavaScript & TypeScript
44+
// build.ts
45+
import { Template, defaultBuildLogger } from 'e2b'
46+
import { template as expoTemplate } from './template'
47+
48+
Template.build(expoTemplate, {
49+
alias: 'expo-app',
50+
cpuCount: 4,
51+
memoryMB: 8192,
52+
onBuildLogs: defaultBuildLogger(),
53+
})
54+
```
55+
56+
```python Python
57+
# build.py
58+
from e2b import Template, default_build_logger
59+
from .template import template as expoTemplate
60+
61+
Template.build(expoTemplate,
62+
alias="expo-app",
63+
cpu_count=4,
64+
memory_mb=8192,
65+
on_build_logs=default_build_logger(),
66+
)
67+
```
68+
</CodeGroup>

docs/template/examples/nextjs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Basic Next.js app with Tailwind and shadcn UI
1212
<CodeGroup>
1313
```typescript JavaScript & TypeScript
1414
// template.ts
15-
import { Template, waitForPort } from 'e2b'
15+
import { Template, waitForURL } from 'e2b'
1616

1717
export const template = Template()
1818
.fromNodeImage('21-slim')

0 commit comments

Comments
 (0)