mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
replaced remix with react-router
This commit is contained in:
@@ -228,7 +228,7 @@ async function buildAdapters() {
|
||||
});
|
||||
|
||||
// specific adatpers
|
||||
await tsup.build(baseConfig("remix"));
|
||||
await tsup.build(baseConfig("react-router"));
|
||||
await tsup.build(baseConfig("bun"));
|
||||
await tsup.build(baseConfig("astro"));
|
||||
await tsup.build(baseConfig("aws"));
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
"bin": "./dist/cli/index.js",
|
||||
"version": "0.9.1",
|
||||
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, Remix, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
||||
"version": "0.10.0-rc.3",
|
||||
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
||||
"homepage": "https://bknd.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -19,7 +19,7 @@
|
||||
"test:coverage": "ALL_TESTS=1 bun test --bail --coverage",
|
||||
"build": "NODE_ENV=production bun run build.ts --minify --types",
|
||||
"build:all": "rm -rf dist && bun run build:static && NODE_ENV=production bun run build.ts --minify --types --clean && bun run build:cli",
|
||||
"build:cli": "bun build src/cli/index.ts --target node --outdir dist/cli --minify",
|
||||
"build:cli": "bun build src/cli/index.ts --target node --outdir dist/cli --env PUBLIC_* --minify",
|
||||
"build:static": "vite build",
|
||||
"watch": "bun run build.ts --types --watch",
|
||||
"types": "bun tsc -p tsconfig.build.json --noEmit",
|
||||
@@ -108,8 +108,8 @@
|
||||
"@hono/node-server": "^1.13.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.x",
|
||||
"react-dom": "^19.x"
|
||||
"react": ">=19",
|
||||
"react-dom": ">=19"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
@@ -174,10 +174,10 @@
|
||||
"import": "./dist/adapter/nextjs/index.js",
|
||||
"require": "./dist/adapter/nextjs/index.cjs"
|
||||
},
|
||||
"./adapter/remix": {
|
||||
"types": "./dist/types/adapter/remix/index.d.ts",
|
||||
"import": "./dist/adapter/remix/index.js",
|
||||
"require": "./dist/adapter/remix/index.cjs"
|
||||
"./adapter/react-router": {
|
||||
"types": "./dist/types/adapter/react-router/index.d.ts",
|
||||
"import": "./dist/adapter/react-router/index.js",
|
||||
"require": "./dist/adapter/react-router/index.cjs"
|
||||
},
|
||||
"./adapter/bun": {
|
||||
"types": "./dist/types/adapter/bun/index.d.ts",
|
||||
@@ -227,6 +227,7 @@
|
||||
"cloudflare",
|
||||
"nextjs",
|
||||
"remix",
|
||||
"react-router",
|
||||
"astro",
|
||||
"bun",
|
||||
"node"
|
||||
|
||||
1
app/src/adapter/react-router/index.ts
Normal file
1
app/src/adapter/react-router/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./react-router.adapter";
|
||||
@@ -1,18 +1,17 @@
|
||||
import type { App } from "bknd";
|
||||
import { type FrameworkBkndConfig, createFrameworkApp } from "bknd/adapter";
|
||||
|
||||
export type RemixBkndConfig<Args = RemixContext> = FrameworkBkndConfig<Args>;
|
||||
|
||||
type RemixContext = {
|
||||
type ReactRouterContext = {
|
||||
request: Request;
|
||||
};
|
||||
export type ReactRouterBkndConfig<Args = ReactRouterContext> = FrameworkBkndConfig<Args>;
|
||||
|
||||
let app: App;
|
||||
let building: boolean = false;
|
||||
|
||||
export async function getApp<Args extends RemixContext = RemixContext>(
|
||||
config: RemixBkndConfig<Args>,
|
||||
args?: Args
|
||||
export async function getApp<Args extends ReactRouterContext = ReactRouterContext>(
|
||||
config: ReactRouterBkndConfig<Args>,
|
||||
args?: Args,
|
||||
) {
|
||||
if (building) {
|
||||
while (building) {
|
||||
@@ -30,8 +29,8 @@ export async function getApp<Args extends RemixContext = RemixContext>(
|
||||
return app;
|
||||
}
|
||||
|
||||
export function serve<Args extends RemixContext = RemixContext>(
|
||||
config: RemixBkndConfig<Args> = {},
|
||||
export function serve<Args extends ReactRouterContext = ReactRouterContext>(
|
||||
config: ReactRouterBkndConfig<Args> = {},
|
||||
) {
|
||||
return async (args: Args) => {
|
||||
app = await getApp(config, args);
|
||||
@@ -1,22 +0,0 @@
|
||||
import { useAuth } from "bknd/client";
|
||||
import type { BkndAdminProps } from "bknd/ui";
|
||||
import { Suspense, lazy, useEffect, useState } from "react";
|
||||
|
||||
export function adminPage(props?: BkndAdminProps) {
|
||||
const Admin = lazy(() => import("bknd/ui").then((mod) => ({ default: mod.Admin })));
|
||||
return () => {
|
||||
const auth = useAuth();
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
useEffect(() => {
|
||||
if (typeof window === "undefined") return;
|
||||
setLoaded(true);
|
||||
}, []);
|
||||
if (!loaded) return null;
|
||||
|
||||
return (
|
||||
<Suspense>
|
||||
<Admin withProvider={{ user: auth.user }} {...props} />
|
||||
</Suspense>
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from "./remix.adapter";
|
||||
export * from "./AdminPage";
|
||||
@@ -24,7 +24,7 @@ const config = {
|
||||
},
|
||||
framework: {
|
||||
nextjs: "Next.js",
|
||||
remix: "Remix",
|
||||
"react-router": "React Router",
|
||||
astro: "Astro",
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { cloudflare } from "./cloudflare";
|
||||
import { nextjs } from "./nextjs";
|
||||
import { remix } from "./remix";
|
||||
|
||||
export type TemplateSetupCtx = {
|
||||
template: Template;
|
||||
@@ -13,7 +11,7 @@ export type Integration =
|
||||
| "bun"
|
||||
| "cloudflare"
|
||||
| "nextjs"
|
||||
| "remix"
|
||||
| "react-router"
|
||||
| "astro"
|
||||
| "aws"
|
||||
| "custom";
|
||||
@@ -43,8 +41,6 @@ export type Template = {
|
||||
|
||||
export const templates: Template[] = [
|
||||
cloudflare,
|
||||
nextjs,
|
||||
remix,
|
||||
{
|
||||
key: "node",
|
||||
title: "Node.js Basic",
|
||||
@@ -61,6 +57,14 @@ export const templates: Template[] = [
|
||||
path: "gh:bknd-io/bknd/examples/bun",
|
||||
ref: true,
|
||||
},
|
||||
{
|
||||
key: "nextjs",
|
||||
title: "Next.js Basic",
|
||||
integration: "nextjs",
|
||||
description: "A basic bknd Next.js starter",
|
||||
path: "gh:bknd-io/bknd/examples/nextjs",
|
||||
ref: true,
|
||||
},
|
||||
{
|
||||
key: "astro",
|
||||
title: "Astro Basic",
|
||||
@@ -69,6 +73,14 @@ export const templates: Template[] = [
|
||||
path: "gh:bknd-io/bknd/examples/astro",
|
||||
ref: true,
|
||||
},
|
||||
{
|
||||
key: "react-router",
|
||||
title: "React Router Basic",
|
||||
integration: "react-router",
|
||||
description: "A basic bknd React Router starter",
|
||||
path: "gh:bknd-io/bknd/examples/react-router",
|
||||
ref: true,
|
||||
},
|
||||
{
|
||||
key: "aws",
|
||||
title: "AWS Lambda Basic",
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { overridePackageJson } from "cli/commands/create/npm";
|
||||
import type { Template } from ".";
|
||||
|
||||
// @todo: add `concurrently`?
|
||||
export const nextjs = {
|
||||
key: "nextjs",
|
||||
title: "Next.js Basic",
|
||||
integration: "nextjs",
|
||||
description: "A basic bknd Next.js starter",
|
||||
path: "gh:bknd-io/bknd/examples/nextjs",
|
||||
scripts: {
|
||||
install: "npm install --force",
|
||||
},
|
||||
ref: true,
|
||||
preinstall: async (ctx) => {
|
||||
// locally it's required to overwrite react, here it is not
|
||||
await overridePackageJson(
|
||||
(pkg) => ({
|
||||
...pkg,
|
||||
dependencies: {
|
||||
...pkg.dependencies,
|
||||
react: undefined,
|
||||
"react-dom": undefined,
|
||||
},
|
||||
}),
|
||||
{ dir: ctx.dir },
|
||||
);
|
||||
},
|
||||
} as const satisfies Template;
|
||||
@@ -1,25 +0,0 @@
|
||||
import { overridePackageJson } from "cli/commands/create/npm";
|
||||
import type { Template } from ".";
|
||||
|
||||
export const remix = {
|
||||
key: "remix",
|
||||
title: "Remix Basic",
|
||||
integration: "remix",
|
||||
description: "A basic bknd Remix starter",
|
||||
path: "gh:bknd-io/bknd/examples/remix",
|
||||
ref: true,
|
||||
preinstall: async (ctx) => {
|
||||
// locally it's required to overwrite react
|
||||
await overridePackageJson(
|
||||
(pkg) => ({
|
||||
...pkg,
|
||||
dependencies: {
|
||||
...pkg.dependencies,
|
||||
react: "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
},
|
||||
}),
|
||||
{ dir: ctx.dir },
|
||||
);
|
||||
},
|
||||
} as const satisfies Template;
|
||||
@@ -37,7 +37,10 @@ const envs = {
|
||||
// cli telemetry
|
||||
cli_telemetry: {
|
||||
key: "BKND_CLI_TELEMETRY",
|
||||
validate: (v: unknown) => {
|
||||
validate: (v: unknown): boolean | undefined => {
|
||||
if (typeof v === "undefined") {
|
||||
return undefined;
|
||||
}
|
||||
return is_toggled(v, true);
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user