Migrate codesandbox to e2b equivalent#2452
Conversation
Co-authored-by: hoakiet98 <hoakiet98@gmail.com>
…operations Co-authored-by: hoakiet98 <hoakiet98@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
| isJsxFile(filePath: string): boolean { | ||
| const ext = path.extname(filePath).toLowerCase(); | ||
| return JSX_FILE_EXTENSIONS.includes(ext); | ||
| } |
There was a problem hiding this comment.
The current implementation of isJsxFile() doesn't check if the file has an extension before checking if it's in JSX_FILE_EXTENSIONS. The original implementation included this check. Without it, files with no extension might cause unexpected behavior.
Consider adding a null check:
isJsxFile(filePath: string): boolean {
const ext = path.extname(filePath).toLowerCase();
return ext && JSX_FILE_EXTENSIONS.includes(ext);
}This ensures the function only returns true when the file has a valid extension that's in the allowed list.
| isJsxFile(filePath: string): boolean { | |
| const ext = path.extname(filePath).toLowerCase(); | |
| return JSX_FILE_EXTENSIONS.includes(ext); | |
| } | |
| isJsxFile(filePath: string): boolean { | |
| const ext = path.extname(filePath).toLowerCase(); | |
| return ext && JSX_FILE_EXTENSIONS.includes(ext); | |
| } |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
%23%23 Description
This PR migrates the entire codebase from using the CodeSandbox SDK to the E2B SDK. This involves updating dependencies, constants, and core components responsible for sandbox management, file operations, terminal sessions, and deployments.
A key improvement in this migration is the adoption of E2B's native file watching API, replacing a previous polling-based solution for better performance and reliability.
%23%23 Related Issues
%23%23 Type of Change
%23%23 Testing
This migration involves a fundamental change in the underlying sandbox provider. Comprehensive functional testing of all features relying on sandbox interactions (e.g., project creation, file editing, terminal usage, deployments, preview loading) is required.
%23%23 Screenshots (if applicable)
%23%23 Additional Notes
.envfile to replaceCSB_API_KEYwithE2B_API_KEY.bun installafter pulling this PR.files.watchDir()for real-time file change detection.Important
Migrate codebase from CodeSandbox to E2B, updating dependencies, file operations, sandbox management, and documentation.
package.jsondependencies to use@e2b/sdk.CSB_API_KEYtoE2B_API_KEYinenv.ts.filesystemAPI for file operations infile-operations.tsandindex.ts.uploadToSandbox()inindex.tsxto handle file uploads to E2B.SessionManagerinsession.tsto manage E2B sessions.sandboxRouterinsandbox.tsto handle E2B sandbox operations.files.watchDir()for file watching infile-watcher.ts.CLISessionImplinterminal.tsto use E2B'sProcessManager.README.mdand other docs.e2b.ts.path.test.tsto reflect new file paths.This description was created by
for 9c393d2. You can customize this summary. It will automatically update as commits are pushed.