mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
Merge pull request #301 from bknd-io/fix/cli-run-open
fix cli url opener and add minimal debug docker config
This commit is contained in:
@@ -67,7 +67,10 @@ export async function startServer(
|
|||||||
$console.info("Server listening on", url);
|
$console.info("Server listening on", url);
|
||||||
|
|
||||||
if (options.open) {
|
if (options.open) {
|
||||||
await open(url);
|
const p = await open(url, { wait: false });
|
||||||
|
p.on("error", () => {
|
||||||
|
$console.warn("Couldn't open url in browser");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
docker/debug/Dockerfile.minimal
Normal file
14
docker/debug/Dockerfile.minimal
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Install Node.js and npm
|
||||||
|
RUN apk add --no-cache nodejs npm
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Create package.json with type: module
|
||||||
|
RUN echo '{"type":"module"}' > package.json
|
||||||
|
|
||||||
|
# Keep container running (can be overridden)
|
||||||
|
CMD ["sh"]
|
||||||
|
|
||||||
12
docker/debug/run-minimal.sh
Executable file
12
docker/debug/run-minimal.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Build the minimal Alpine image with Node.js
|
||||||
|
docker build -f Dockerfile.minimal -t bknd-minimal .
|
||||||
|
|
||||||
|
# Run the container with the whole app/src directory mapped
|
||||||
|
docker run -it --rm \
|
||||||
|
-v "$(pwd)/../app:/app/app" \
|
||||||
|
-w /app \
|
||||||
|
-p 1337:1337 \
|
||||||
|
bknd-minimal
|
||||||
|
|
||||||
@@ -40,12 +40,6 @@ bun add bknd
|
|||||||
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
<Callout type="info">
|
|
||||||
The guide below assumes you're using Astro v4. We've experienced issues with
|
|
||||||
Astro DB using v5, see [this
|
|
||||||
issue](https://github.com/withastro/astro/issues/12474).
|
|
||||||
</Callout>
|
|
||||||
|
|
||||||
For the Astro integration to work, you also need to [add the react integration](https://docs.astro.build/en/guides/integrations-guide/react/):
|
For the Astro integration to work, you also need to [add the react integration](https://docs.astro.build/en/guides/integrations-guide/react/):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -159,7 +153,7 @@ Create a new catch-all route at `src/pages/admin/[...admin].astro`:
|
|||||||
import { Admin } from "bknd/ui";
|
import { Admin } from "bknd/ui";
|
||||||
import "bknd/dist/styles.css";
|
import "bknd/dist/styles.css";
|
||||||
|
|
||||||
import { getApi } from "bknd/adapter/astro";
|
import { getApi } from "../../../bknd.ts"; // /src/bknd.ts
|
||||||
|
|
||||||
const api = await getApi(Astro, { mode: "dynamic" });
|
const api = await getApi(Astro, { mode: "dynamic" });
|
||||||
const user = api.getUser();
|
const user = api.getUser();
|
||||||
|
|||||||
Reference in New Issue
Block a user