Skip to content

Commit

Permalink
fix: 🐛 deployments problems (:/)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabraghib committed Apr 10, 2024
1 parent 8b47f71 commit 1916457
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
14 changes: 14 additions & 0 deletions website/app/api/run-code/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,23 @@ export async function POST(req: Request) {
output: 'Error: Cannot run code with dakhel call',
});
}
await setupDarijaScript();
return Response.json(await runCodeWithInput(code));
}

async function setupDarijaScript() {
try {
const { stderr } = await execute('darijascript --version');
if (stderr) {
throw new Error(stderr);
}
} catch (error) {
await execute(
'wget https://github.com/rabraghib/darijascript/releases/latest/download/darijascript-bin -O /usr/local/bin/darijascript && chmod +x /usr/local/bin/darijascript'
);
}
}

async function runCodeWithInput(code: string) {
try {
const codeFilePath = temporaryFile({ extension: 'ds' });
Expand Down
5 changes: 0 additions & 5 deletions website/install.sh

This file was deleted.

3 changes: 0 additions & 3 deletions website/vercel.json

This file was deleted.

0 comments on commit 1916457

Please sign in to comment.