Skip to content

Commit 5501f70

Browse files
committed
feat: add template deploy command to the main repository
1 parent 102c01b commit 5501f70

File tree

8 files changed

+17
-10
lines changed

8 files changed

+17
-10
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,14 @@ To deploy and test templates, you must have an [E2B account](https://e2b.dev/) a
255255
e2b auth login
256256
```
257257

258-
Then, navigate to your template directory and run the following command where **TEMPLATENAME** is the name of your template:
258+
To deploy a template to E2B, run:
259259

260260
```
261-
e2b template build -d e2b.Dockerfile -n TEMPLATENAME
261+
npm run templates:deploy [TEMPLATENAME]
262262
```
263263

264+
Leaving out the TEMPLATENAME parameter will redeploy all previously deployed templates.
265+
264266
Finally, to test your template run:
265267

266268
```

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"dev:watch": "concurrently -k -n LIB,DB,WEB,SERVER -c yellow,magenta,blue,green \"npm run dev -w lib\" \"npm run dev -w db\" \"npm run dev -w web\" \"npm run dev -w server\"",
2525
"start": "concurrently -k \"npm start -w web\" \"npm start -w server\"",
2626
"start:web": "npm start -w web",
27-
"start:server": "npm start -w server"
27+
"start:server": "npm start -w server",
28+
"templates:deploy": "npm run deploy -w templates"
2829
},
2930
"devDependencies": {
3031
"concurrently": "^8.2.2"

templates/deploy.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
if [ "$1" ]; then
4+
cd "$1" && e2b template build
5+
else
6+
for dir in */; do
7+
[ -f "$dir/e2b.toml" ] && (cd "$dir" && e2b template build)
8+
done
9+
fi

templates/nextjs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"build": "next build",
88
"start": "next start",
99
"lint": "next lint",
10-
"build-template": "e2b template build -d e2b.Dockerfile -n gitwit-nextjs"
1110
},
1211
"dependencies": {
1312
"next": "^14.1.0",

templates/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"types": "dist/index.d.ts",
77
"scripts": {
88
"build": "tsc",
9-
"dev": "tsc --watch"
9+
"dev": "tsc --watch",
10+
"deploy": "sh deploy.sh"
1011
},
1112
"exports": {
1213
".": "./dist/index.js",

templates/reactjs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"dev": "vite",
88
"build": "tsc && vite build",
99
"preview": "vite preview",
10-
"build-template": "e2b template build -d e2b.Dockerfile -n gitwit-reactjs"
1110
},
1211
"keywords": [],
1312
"author": "",

templates/streamlit/build-template.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

templates/vanillajs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"dev": "vite",
77
"build": "vite build",
88
"preview": "vite preview",
9-
"build-template": "e2b template build -d e2b.Dockerfile -n gitwit-vanillajs"
109
},
1110
"dependencies": {
1211
"vite": "^5.0.12"

0 commit comments

Comments
 (0)