Skip to content

Commit a0d79ec

Browse files
committed
resolved merging main conflicts
2 parents 803a991 + 8b3bcf7 commit a0d79ec

24 files changed

+4330
-117
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## [2.4.1](https://github.com/codesandbox/codesandbox-sdk/compare/v2.4.0...v2.4.1) (2025-10-23)
4+
5+
6+
### Bug Fixes
7+
8+
* reconnect issue ([#216](https://github.com/codesandbox/codesandbox-sdk/issues/216)) ([2dfa670](https://github.com/codesandbox/codesandbox-sdk/commit/2dfa670a62d320ffe9b50831e212ede5ae90732d))
9+
10+
## [2.4.0](https://github.com/codesandbox/codesandbox-sdk/compare/v2.3.0...v2.4.0) (2025-10-16)
11+
12+
13+
### Features
14+
15+
* batch writes in template build ([#205](https://github.com/codesandbox/codesandbox-sdk/issues/205)) ([9b2f3f6](https://github.com/codesandbox/codesandbox-sdk/commit/9b2f3f66c4a0b3fa7c9b2f29c456875bea807ead))
16+
* command error with exit code ([#203](https://github.com/codesandbox/codesandbox-sdk/issues/203)) ([652c2ef](https://github.com/codesandbox/codesandbox-sdk/commit/652c2efb900ce36081f0a1dca6919b288508116b))
17+
18+
19+
### Bug Fixes
20+
21+
* batch session initialization commands ([#207](https://github.com/codesandbox/codesandbox-sdk/issues/207)) ([363faca](https://github.com/codesandbox/codesandbox-sdk/commit/363faca904324d3daecbde8990555dfa3a5eb577))
22+
* handle spacing in env variables of commands ([#202](https://github.com/codesandbox/codesandbox-sdk/issues/202)) ([da5a772](https://github.com/codesandbox/codesandbox-sdk/commit/da5a7724d0d264c8088747c137a45f3cb6c534d6))
23+
324
## [2.3.0](https://github.com/codesandbox/codesandbox-sdk/compare/v2.2.1...v2.3.0) (2025-09-29)
425

526

demo/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

demo/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# CodeSandbox SDK Demo
2+
3+
This is a demo application showcasing the CodeSandbox SDK with an Express server running Vite middleware in a single process.
4+
5+
## Architecture
6+
7+
The demo uses a TypeScript Express server that integrates Vite as middleware, providing:
8+
- **API routes** for backend functionality
9+
- **Vite dev server** for hot module replacement and frontend serving
10+
- **Single process** - no need to run separate frontend/backend servers
11+
12+
## Setup
13+
14+
1. Build the SDK from the root directory:
15+
```bash
16+
npm run build
17+
```
18+
19+
2. Install demo dependencies:
20+
```bash
21+
cd demo
22+
npm install
23+
```
24+
25+
3. Run the demo:
26+
```bash
27+
npm run dev
28+
```
29+
30+
This will start the server at `http://localhost:3000` with both API routes and the Vite frontend.
31+
32+
## Available Scripts
33+
34+
- `npm run dev` - Start the TypeScript server with Vite middleware
35+
- `npm run build` - Build the frontend for production
36+
- `npm run preview` - Preview production build
37+
38+
## Usage
39+
40+
### Frontend (Vite + React)
41+
42+
The demo app imports the SDK from the local build using:
43+
44+
```typescript
45+
import CodeSandbox from '@codesandbox/sdk'
46+
```
47+
48+
You can modify `src/App.tsx` to add your SDK demo code.
49+
50+
### Backend (Express + Vite Middleware)
51+
52+
The Express server (`server.ts`) provides:
53+
54+
- API routes (mounted before Vite middleware):
55+
- `GET /api/health` - Health check endpoint
56+
- `GET /api/example` - Example API endpoint
57+
- Vite middleware for serving the frontend with HMR
58+
59+
Add your custom API routes in `server.ts` before the Vite middleware setup to support your SDK demo needs (like handling API keys, proxying requests, etc.).

demo/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>CodeSandbox SDK Demo</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)