mirror of
https://github.com/Xevion/Pac-Man.git
synced 2026-01-31 06:25:09 -06:00
feat(web): auto-install emsdk and set default caddy port
- Clone and install emsdk automatically if not present - Configure caddy to listen on port 8547 by default
This commit is contained in:
@@ -38,7 +38,7 @@ samply:
|
|||||||
web *args:
|
web *args:
|
||||||
bun run pacman/web.build.ts {{args}}
|
bun run pacman/web.build.ts {{args}}
|
||||||
bun run --cwd web build
|
bun run --cwd web build
|
||||||
caddy file-server --root web/dist/client
|
caddy file-server --root web/dist/client --listen :8547
|
||||||
|
|
||||||
# Fix linting errors & formatting
|
# Fix linting errors & formatting
|
||||||
fix:
|
fix:
|
||||||
|
|||||||
+33
-4
@@ -147,11 +147,40 @@ async function activateEmsdk(
|
|||||||
return { vars: null };
|
return { vars: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the emsdk directory exists
|
// Check if the emsdk directory exists, clone and install if not
|
||||||
if (!(await fs.exists(emsdkDir))) {
|
if (!(await fs.exists(emsdkDir))) {
|
||||||
return {
|
logger.info("Emscripten SDK not found, cloning and installing...");
|
||||||
err: `Emscripten SDK directory not found at ${emsdkDir}. Please install or clone 'emsdk' and try again.`,
|
|
||||||
};
|
// Clone the emsdk repository
|
||||||
|
logger.debug("Cloning emsdk repository...");
|
||||||
|
const cloneResult =
|
||||||
|
await $`git clone https://github.com/emscripten-core/emsdk.git ${emsdkDir}`.quiet();
|
||||||
|
if (cloneResult.exitCode !== 0) {
|
||||||
|
return {
|
||||||
|
err: `Failed to clone emsdk: ${cloneResult.stderr.toString()}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Install latest version
|
||||||
|
logger.debug("Installing latest Emscripten version...");
|
||||||
|
const emsdkBinary = join(emsdkDir, os.type === "windows" ? "emsdk.bat" : "emsdk");
|
||||||
|
const installResult = await $`${emsdkBinary} install latest`.quiet();
|
||||||
|
if (installResult.exitCode !== 0) {
|
||||||
|
return {
|
||||||
|
err: `Failed to install emsdk: ${installResult.stderr.toString()}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activate latest version
|
||||||
|
logger.debug("Activating latest Emscripten version...");
|
||||||
|
const activateResult = await $`${emsdkBinary} activate latest`.quiet();
|
||||||
|
if (activateResult.exitCode !== 0) {
|
||||||
|
return {
|
||||||
|
err: `Failed to activate emsdk: ${activateResult.stderr.toString()}`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("Emscripten SDK installed and activated successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the emsdk directory is activated/installed properly for the current OS
|
// Check if the emsdk directory is activated/installed properly for the current OS
|
||||||
|
|||||||
Reference in New Issue
Block a user