Skip to content

Commit

Permalink
feat: opens browser tab by default now
Browse files Browse the repository at this point in the history
  • Loading branch information
AidanTilgner committed Jun 30, 2023
1 parent 7799f2e commit dc2c773
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 10 additions & 1 deletion esbuild.dev.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ import * as esbuild from "esbuild";
import { sassPlugin, postcssModules } from "esbuild-sass-plugin";
import { config } from "dotenv";
import http from "http";
import { exec } from "child_process";

config();

const openBrowserTab = async () => {
const url = `http://localhost:${process.env.PORT || 3000}`;
const cmd = process.platform === "win32" ? "start" : "open";
console.info(`Opening ${url} in browser...`);
exec(`${cmd} ${url}`);
}

const watch = async () => {
const ctx = await esbuild.context({
entryPoints: ["client/index.tsx"],
Expand Down Expand Up @@ -66,5 +74,6 @@ const watch = async () => {
});
await ctx.watch();
console.info("Served and Watching...");
openBrowserTab();
};
watch();
watch();
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"dev:client": "node esbuild.dev.config.mjs",
"dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
"build:client": "node esbuild.config.mjs",
"build:widgets": "node esbuild.widgets.config.mjs",
"build": "npm run build:client",
"typeorm": "typeorm-ts-node-esm",
"migrations:run": "typeorm-ts-node-esm migration:run -d database/index.ts",
Expand Down

0 comments on commit dc2c773

Please sign in to comment.