Skip to content

Commit fe2f35b

Browse files
author
benchify
committed
modifying buildCmd etc to hit benchify api endpoint
1 parent 6f25773 commit fe2f35b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

app/api/generate/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function POST(request: NextRequest) {
3030

3131
// // Repair the generated code using Benchify's API
3232
const { repairedFiles, buildOutput } = await repairCode(validatedFiles);
33-
33+
3434
const { sbxId, template, url } = await createSandbox({ files: generatedFiles });
3535

3636
console.log("Preview URL: ", url);

lib/benchify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (!BENCHIFY_API_KEY) {
1818
export async function repairCode(files: z.infer<typeof benchifyFileSchema>): Promise<{ repairedFiles: z.infer<typeof benchifyFileSchema>, buildOutput: string }> {
1919
try {
2020
// Simple build command to verify syntax
21-
const buildCmd = "npm run dev";
21+
const buildCmd = "npx vite build";
2222

2323
// Validate request against Benchify API schema
2424
const requestData = benchifyRequestSchema.parse({
@@ -71,7 +71,7 @@ export async function repairCode(files: z.infer<typeof benchifyFileSchema>): Pro
7171
const parsedFiles = benchifyFileSchema.parse(files);
7272
const repairedFiles = parsedFiles.map(file => {
7373
if (result.diff) {
74-
const patchResult = applyPatch(file.contents, result.diff);
74+
const patchResult = applyPatch(file.content, result.diff);
7575
return {
7676
path: file.path,
7777
content: typeof patchResult === 'string' ? patchResult : file.content

lib/e2b.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function createSandbox({ files }: { files: z.infer<typeof benchifyF
3030
const devDependencies = packageJson.devDependencies || {};
3131

3232
// Filter out pre-installed dependencies (vue, tailwindcss, etc.)
33-
const preInstalled = ['vue', 'tailwindcss', 'autoprefixer', 'postcss', 'vite', '@vitejs/plugin-vue', '@vue/compiler-sfc'];
33+
const preInstalled = ['vue', "typescript", 'tailwindcss', 'autoprefixer', 'postcss', 'vite', '@vitejs/plugin-vue', '@vue/compiler-sfc'];
3434

3535
// Get new deps that need to be installed
3636
const newDeps = Object.keys(dependencies).filter(dep => !preInstalled.includes(dep));

0 commit comments

Comments
 (0)