Skip to content

Commit

Permalink
✨ Add the ./run command to use the power of Bun
Browse files Browse the repository at this point in the history
  • Loading branch information
siguici committed Nov 12, 2023
1 parent c53b125 commit ba4fda5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const config: PlaywrightTestConfig = {

/* Run your local dev server before starting the tests */
webServer: {
command: "php artisan serve --port=4321",
command: "./run serve --port=4321",
port: 4321,
reuseExistingServer: !process.env.CI,
},
Expand Down
21 changes: 21 additions & 0 deletions run
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bun

const args = process.argv.slice(2);

const proc = Bun.spawn(["php", "artisan", ...args], {
cwd: process.cwd(),
env: process.env,
stdin: "inherit",
stdout: "inherit",
stderr: "inherit",
async onExit(proc, exitCode, signalCode, error) {
if (error) {
console.error(error);
process.exit(1);
}

const result = await new Response(proc.stderr || proc.stdout).text();
exitCode !== 0 ? console.error(result) : console.log(result);
process.exit(exitCode);
},
});

0 comments on commit ba4fda5

Please sign in to comment.