@batijs/cli 0.0.650 → 0.0.651
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +1 -1
- package/dist/boilerplates/@batijs/aws/files/cdk/bin/infrastructure.ts +1 -1
- package/dist/boilerplates/@batijs/better-auth/files/database/better-auth/migrate.ts +1 -3
- package/dist/boilerplates/@batijs/better-auth/files/database/drizzle/schema/auth.ts +5 -5
- package/dist/boilerplates/@batijs/better-auth/files/server/better-auth-handler.ts +2 -2
- package/dist/boilerplates/@batijs/better-auth/files/server/better-auth.ts +8 -8
- package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +9 -9
- package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +9 -9
- package/dist/boilerplates/@batijs/docker-compose/files/docker-compose.yml +6 -6
- package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/db.ts +3 -3
- package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/todos.ts +10 -10
- package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/schema/todos.ts +2 -2
- package/dist/boilerplates/@batijs/drizzle/files/drizzle.config.ts +3 -3
- package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/todos.d.mts +6 -6
- package/dist/boilerplates/@batijs/edgeone/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/elysia/files/+server.ts +1 -1
- package/dist/boilerplates/@batijs/elysia/files/server/elysia.ts +9 -9
- package/dist/boilerplates/@batijs/eslint/files/eslint.config.ts +14 -14
- package/dist/boilerplates/@batijs/express/files/+server.ts +10 -10
- package/dist/boilerplates/@batijs/fastify/files/+server.ts +10 -10
- package/dist/boilerplates/@batijs/hono/files/+server.ts +2 -2
- package/dist/boilerplates/@batijs/hono/files/entry_aws_lambda.ts +1 -3
- package/dist/boilerplates/@batijs/hono/files/server/hono.ts +9 -9
- package/dist/boilerplates/@batijs/kysely/files/$vite.config.ts.js +9 -12
- package/dist/boilerplates/@batijs/kysely/files/database/kysely/db.ts +5 -5
- package/dist/boilerplates/@batijs/kysely/files/database/kysely/migrate.ts +2 -4
- package/dist/boilerplates/@batijs/kysely/files/database/kysely/migrations/001_create_todos_table.ts +2 -3
- package/dist/boilerplates/@batijs/kysely/files/database/kysely/queries/todos.ts +8 -8
- package/dist/boilerplates/@batijs/kysely/files/vite-plugin-input.ts +1 -2
- package/dist/boilerplates/@batijs/kysely/types/database/kysely/queries/todos.d.mts +8 -8
- package/dist/boilerplates/@batijs/netlify/files/$vite.config.ts.js +8 -8
- package/dist/boilerplates/@batijs/postgres/files/database/postgres/db.ts +1 -1
- package/dist/boilerplates/@batijs/postgres/files/database/postgres/schema/todos.ts +1 -1
- package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/react/files/pages/+Head.tsx +6 -6
- package/dist/boilerplates/@batijs/react/files/pages/+Layout.tsx +14 -14
- package/dist/boilerplates/@batijs/react/files/pages/+config.ts +3 -3
- package/dist/boilerplates/@batijs/react/files/pages/index/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/index/Counter.tsx +3 -3
- package/dist/boilerplates/@batijs/react/files/pages/todo/TodoList.tsx +6 -6
- package/dist/boilerplates/@batijs/react-better-auth/files/pages/account/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/react-better-auth/files/pages/login/+Page.tsx +4 -4
- package/dist/boilerplates/@batijs/react-better-auth/files/pages/signup/+Page.tsx +4 -4
- package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +10 -10
- package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +12 -18
- package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +5 -27
- package/dist/boilerplates/@batijs/shared/files/vite.config.ts +1 -1
- package/dist/boilerplates/@batijs/shared-db/files/server/db-middleware.ts +21 -21
- package/dist/boilerplates/@batijs/shared-db/types/server/db-middleware.d.mts +10 -10
- package/dist/boilerplates/@batijs/shared-env/files/server/env.ts +6 -4
- package/dist/boilerplates/@batijs/shared-env/files/server/load.ts +1 -1
- package/dist/boilerplates/@batijs/shared-env/types/server/env.d.mts +2 -2
- package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +16 -16
- package/dist/boilerplates/@batijs/shared-server/types/server/create-todo-handler.d.mts +10 -10
- package/dist/boilerplates/@batijs/shared-todo/files/global.d.ts +11 -11
- package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+config.ts +1 -4
- package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+data.ts +5 -5
- package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/solid/files/pages/+Head.tsx +3 -4
- package/dist/boilerplates/@batijs/solid/files/pages/+Layout.tsx +10 -10
- package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +3 -3
- package/dist/boilerplates/@batijs/solid/files/pages/index/Counter.tsx +2 -2
- package/dist/boilerplates/@batijs/solid/files/pages/todo/TodoList.tsx +6 -6
- package/dist/boilerplates/@batijs/solid-better-auth/files/pages/account/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/solid-better-auth/files/pages/login/+Page.tsx +4 -4
- package/dist/boilerplates/@batijs/solid-better-auth/files/pages/signup/+Page.tsx +4 -4
- package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/db.ts +1 -1
- package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/schema/todos.ts +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/tailwindcss/files/pages/tailwind.css +2 -2
- package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +8 -8
- package/dist/boilerplates/@batijs/telefunc/files/global.d.ts +12 -12
- package/dist/boilerplates/@batijs/telefunc/files/pages/todo/TodoList.telefunc.ts +5 -5
- package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +12 -12
- package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +4 -4
- package/dist/boilerplates/@batijs/trpc/files/trpc/server.ts +15 -15
- package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +15 -15
- package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +8 -8
- package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/vue/files/components/Content.vue +2 -2
- package/dist/boilerplates/@batijs/vue/files/components/Counter.vue +3 -3
- package/dist/boilerplates/@batijs/vue/files/components/Logo.vue +2 -2
- package/dist/boilerplates/@batijs/vue/files/components/Sidebar.vue +2 -2
- package/dist/boilerplates/@batijs/vue/files/pages/+Head.vue +2 -3
- package/dist/boilerplates/@batijs/vue/files/pages/+Layout.vue +3 -3
- package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +3 -3
- package/dist/boilerplates/@batijs/vue/files/pages/+onCreateApp.ts +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/todo/TodoList.vue +8 -8
- package/dist/boilerplates/@batijs/vue-better-auth/files/pages/account/+Page.vue +1 -1
- package/dist/boilerplates/@batijs/vue-better-auth/files/pages/login/+Page.vue +3 -3
- package/dist/boilerplates/@batijs/vue-better-auth/files/pages/signup/+Page.vue +2 -2
- package/dist/index.js +40 -43
- package/package.json +5 -5
|
@@ -5,7 +5,7 @@ import * as certificatemanager from "aws-cdk-lib/aws-certificatemanager";
|
|
|
5
5
|
import * as route53 from "aws-cdk-lib/aws-route53";
|
|
6
6
|
import { VikeStack } from "../lib/vike-stack";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// $$.keepCommentsIf(false)
|
|
9
9
|
// @ts-expect-error file will be generated by the transformer
|
|
10
10
|
import { stackNameSuffix } from "../stack-name-suffix.json";
|
|
11
11
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// $$.keepFileIf(!$$.BATI.hasD1 && !$$.BATI.has("drizzle"))
|
|
3
2
|
import "@batijs/shared-env/server/load";
|
|
4
3
|
import { getMigrations } from "better-auth/db/migration";
|
|
5
4
|
import { getAuthConfig } from "../../server/better-auth";
|
|
@@ -17,4 +16,3 @@ console.log("Better Auth tables are up to date");
|
|
|
17
16
|
// The database driver keeps the event loop alive (e.g. Postgres connection pool); exit explicitly
|
|
18
17
|
// so this one-shot script terminates instead of hanging.
|
|
19
18
|
process.exit(0);
|
|
20
|
-
/*{ /if }*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/* $$.keepFileIfImported */
|
|
2
2
|
import { boolean, pgTable, text as pgText, timestamp } from "drizzle-orm/pg-core";
|
|
3
3
|
import { integer, sqliteTable, text as sqliteText } from "drizzle-orm/sqlite-core";
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { integer, sqliteTable, text as sqliteText } from "drizzle-orm/sqlite-cor
|
|
|
6
6
|
// Regenerate with `npx @better-auth/cli generate` if you customize the Better Auth config.
|
|
7
7
|
// Column names are snake_case to match Better Auth's Drizzle adapter defaults.
|
|
8
8
|
|
|
9
|
-
export const user = BATI.has("postgres")
|
|
9
|
+
export const user = $$.BATI.has("postgres")
|
|
10
10
|
? pgTable("user", {
|
|
11
11
|
id: pgText("id").primaryKey(),
|
|
12
12
|
name: pgText("name").notNull(),
|
|
@@ -26,7 +26,7 @@ export const user = BATI.has("postgres")
|
|
|
26
26
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
export const session = BATI.has("postgres")
|
|
29
|
+
export const session = $$.BATI.has("postgres")
|
|
30
30
|
? pgTable("session", {
|
|
31
31
|
id: pgText("id").primaryKey(),
|
|
32
32
|
expiresAt: timestamp("expires_at").notNull(),
|
|
@@ -48,7 +48,7 @@ export const session = BATI.has("postgres")
|
|
|
48
48
|
userId: sqliteText("user_id").notNull(),
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
export const account = BATI.has("postgres")
|
|
51
|
+
export const account = $$.BATI.has("postgres")
|
|
52
52
|
? pgTable("account", {
|
|
53
53
|
id: pgText("id").primaryKey(),
|
|
54
54
|
accountId: pgText("account_id").notNull(),
|
|
@@ -80,7 +80,7 @@ export const account = BATI.has("postgres")
|
|
|
80
80
|
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull(),
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
export const verification = BATI.has("postgres")
|
|
83
|
+
export const verification = $$.BATI.has("postgres")
|
|
84
84
|
? pgTable("verification", {
|
|
85
85
|
id: pgText("id").primaryKey(),
|
|
86
86
|
identifier: pgText("identifier").notNull(),
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import { betterAuth } from "better-auth";
|
|
8
8
|
import { getAuthConfig } from "./better-auth";
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// !$$.BATI.hasD1
|
|
11
11
|
let authSingleton: ReturnType<typeof betterAuth> | undefined;
|
|
12
12
|
|
|
13
13
|
// On Cloudflare the D1 binding is request-scoped (fresh instance per request); elsewhere it's memoized.
|
|
14
14
|
function getAuth(runtime: RuntimeAdapter) {
|
|
15
|
-
if (BATI.hasD1) {
|
|
15
|
+
if ($$.BATI.hasD1) {
|
|
16
16
|
return betterAuth(getAuthConfig(runtime));
|
|
17
17
|
} else {
|
|
18
18
|
authSingleton ??= betterAuth(getAuthConfig(runtime));
|
|
@@ -10,7 +10,7 @@ import { PostgresJSDialect } from "kysely-postgres-js";
|
|
|
10
10
|
import postgres from "postgres";
|
|
11
11
|
import * as authSchema from "../database/drizzle/schema/auth";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// $$.BATI.hasD1
|
|
14
14
|
function getD1(runtime?: RuntimeAdapter): D1Database {
|
|
15
15
|
if (runtime?.runtime === "workerd" && runtime.env) {
|
|
16
16
|
return runtime.env.DB as D1Database;
|
|
@@ -18,11 +18,11 @@ function getD1(runtime?: RuntimeAdapter): D1Database {
|
|
|
18
18
|
throw new Error("Cloudflare D1 binding (DB) is not available");
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// $$.BATI.has("drizzle")
|
|
22
22
|
function getDrizzleDb(_runtime?: RuntimeAdapter) {
|
|
23
|
-
if (BATI.hasD1) {
|
|
23
|
+
if ($$.BATI.hasD1) {
|
|
24
24
|
return dbD1(getD1(_runtime));
|
|
25
|
-
} else if (BATI.has("postgres")) {
|
|
25
|
+
} else if ($$.BATI.has("postgres")) {
|
|
26
26
|
return dbPostgres();
|
|
27
27
|
} else {
|
|
28
28
|
return dbSqlite();
|
|
@@ -33,18 +33,18 @@ function getDrizzleDb(_runtime?: RuntimeAdapter) {
|
|
|
33
33
|
// With Drizzle it reuses the app's instance (Drizzle owns the schema + migrations); otherwise it
|
|
34
34
|
// opens its own connection and creates the tables via `better-auth:migrate` (or a D1 SQL migration).
|
|
35
35
|
function getDatabase(_runtime?: RuntimeAdapter): BetterAuthOptions["database"] {
|
|
36
|
-
if (BATI.has("drizzle")) {
|
|
36
|
+
if ($$.BATI.has("drizzle")) {
|
|
37
37
|
return drizzleAdapter(getDrizzleDb(_runtime), {
|
|
38
|
-
provider: BATI.has("postgres") ? "pg" : "sqlite",
|
|
38
|
+
provider: $$.BATI.has("postgres") ? "pg" : "sqlite",
|
|
39
39
|
schema: authSchema,
|
|
40
40
|
});
|
|
41
|
-
} else if (BATI.hasD1) {
|
|
41
|
+
} else if ($$.BATI.hasD1) {
|
|
42
42
|
// Cloudflare D1 is the SQLite engine on Workers, reached through Kysely's D1 dialect.
|
|
43
43
|
return {
|
|
44
44
|
db: new Kysely({ dialect: new D1Dialect({ database: getD1(_runtime) }) }),
|
|
45
45
|
type: "sqlite" as const,
|
|
46
46
|
};
|
|
47
|
-
} else if (BATI.has("postgres")) {
|
|
47
|
+
} else if ($$.BATI.has("postgres")) {
|
|
48
48
|
// postgres.js via Kysely's dialect — the same driver the rest of the app uses (and Bun-friendly).
|
|
49
49
|
if (!env.DATABASE_URL) {
|
|
50
50
|
throw new Error("Missing DATABASE_URL in .env file");
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { addVitePlugin,
|
|
3
|
+
import { addVitePlugin, transformConfig } from "@batijs/core";
|
|
4
4
|
//#region ../../boilerplates/cloudflare/dist/files/$vite.config.ts.mjs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
function getViteConfig(props) {
|
|
6
|
+
return transformConfig(props, (root) => {
|
|
7
|
+
addVitePlugin(root, {
|
|
8
|
+
from: "@cloudflare/vite-plugin",
|
|
9
|
+
constructor: "cloudflare",
|
|
10
|
+
named: true,
|
|
11
|
+
options: `{ viteEnvironment: { name: "ssr" } }`
|
|
12
|
+
});
|
|
12
13
|
});
|
|
13
|
-
return mod.generate().code;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
export { getViteConfig as default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { addVitePlugin,
|
|
3
|
+
import { addVitePlugin, transformConfig } from "@batijs/core";
|
|
4
4
|
//#region ../../boilerplates/compiled/dist/files/$vite.config.ts.mjs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
function getViteConfig(props) {
|
|
6
|
+
return transformConfig(props, (root) => {
|
|
7
|
+
addVitePlugin(root, {
|
|
8
|
+
from: "vite-plugin-compiled-react",
|
|
9
|
+
constructor: "compiled",
|
|
10
|
+
named: true,
|
|
11
|
+
options: `{ extract: true }`
|
|
12
|
+
});
|
|
12
13
|
});
|
|
13
|
-
return mod.generate().code;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
export { getViteConfig as default };
|
|
@@ -8,16 +8,16 @@ services:
|
|
|
8
8
|
environment:
|
|
9
9
|
- NODE_ENV=production
|
|
10
10
|
- PORT=3000
|
|
11
|
-
# BATI.hasDatabase &&
|
|
11
|
+
# $$.BATI.hasDatabase && !$$.BATI.has("postgres")
|
|
12
12
|
volumes:
|
|
13
13
|
- sqlite_data:/app/data
|
|
14
|
-
# BATI.has("postgres")
|
|
14
|
+
# $$.BATI.has("postgres")
|
|
15
15
|
depends_on:
|
|
16
16
|
postgres:
|
|
17
17
|
condition: service_healthy
|
|
18
18
|
restart: unless-stopped
|
|
19
19
|
|
|
20
|
-
# BATI.has("postgres")
|
|
20
|
+
# $$.BATI.has("postgres")
|
|
21
21
|
postgres:
|
|
22
22
|
image: postgres:18-alpine
|
|
23
23
|
environment:
|
|
@@ -33,9 +33,9 @@ services:
|
|
|
33
33
|
retries: 10
|
|
34
34
|
restart: unless-stopped
|
|
35
35
|
|
|
36
|
-
# BATI.hasDatabase
|
|
36
|
+
# $$.BATI.hasDatabase
|
|
37
37
|
volumes:
|
|
38
|
-
# BATI.hasDatabase &&
|
|
38
|
+
# $$.BATI.hasDatabase && !$$.BATI.has("postgres")
|
|
39
39
|
sqlite_data: {}
|
|
40
|
-
# BATI.has("postgres")
|
|
40
|
+
# $$.BATI.has("postgres")
|
|
41
41
|
postgres_data: {}
|
|
@@ -4,18 +4,18 @@ import { drizzle as drizzleD1 } from "drizzle-orm/d1";
|
|
|
4
4
|
import { drizzle as drizzlePostgres } from "drizzle-orm/postgres-js";
|
|
5
5
|
import postgres from "postgres";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
// $$.BATI.has("sqlite") && !$$.BATI.hasD1
|
|
8
8
|
export function dbSqlite() {
|
|
9
9
|
const sqlite = new Database(process.env.DATABASE_URL);
|
|
10
10
|
return drizzleSqlite(sqlite);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// $$.BATI.hasD1
|
|
14
14
|
export function dbD1(d1: D1Database) {
|
|
15
15
|
return drizzleD1(d1);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// $$.BATI.has("postgres")
|
|
19
19
|
export function dbPostgres() {
|
|
20
20
|
if (!process.env.DATABASE_URL) {
|
|
21
21
|
throw new Error("Missing DATABASE_URL in .env file");
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/* $$.keepFileIfImported */
|
|
2
2
|
|
|
3
3
|
import type { dbD1, dbPostgres, dbSqlite } from "../db";
|
|
4
4
|
import { todoTable } from "../schema/todos";
|
|
5
5
|
|
|
6
6
|
export function insertTodo(
|
|
7
|
-
db:
|
|
8
|
-
'BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
9
|
-
"
|
|
7
|
+
db: $$.If<{
|
|
8
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
9
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbSqlite>;
|
|
10
10
|
_: ReturnType<typeof dbD1>;
|
|
11
11
|
}>,
|
|
12
12
|
text: string,
|
|
13
13
|
) {
|
|
14
|
-
return (db as
|
|
14
|
+
return (db as $$.Any).insert(todoTable).values({ text });
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export async function getAllTodos(
|
|
18
|
-
db:
|
|
18
|
+
db: $$.If<
|
|
19
19
|
{
|
|
20
|
-
'BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
21
|
-
"
|
|
20
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
21
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbSqlite>;
|
|
22
22
|
_: ReturnType<typeof dbD1>;
|
|
23
23
|
},
|
|
24
24
|
"union"
|
|
25
25
|
>,
|
|
26
26
|
) {
|
|
27
|
-
const query = (db as
|
|
28
|
-
return BATI.has("postgres") ? query : query.all();
|
|
27
|
+
const query = (db as $$.Any).select().from(todoTable);
|
|
28
|
+
return $$.BATI.has("postgres") ? query : query.all();
|
|
29
29
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/* $$.keepFileIfImported */
|
|
2
2
|
import { pgTable, serial, varchar } from "drizzle-orm/pg-core";
|
|
3
3
|
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
4
4
|
|
|
5
5
|
// Example of defining a schema in Drizzle ORM.
|
|
6
|
-
export const todoTable = BATI.has("postgres")
|
|
6
|
+
export const todoTable = $$.BATI.has("postgres")
|
|
7
7
|
? pgTable("todos", {
|
|
8
8
|
id: serial("id").primaryKey(),
|
|
9
9
|
text: varchar("text", { length: 50 }).notNull(),
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "@batijs/shared-env/server/load";
|
|
2
2
|
import { defineConfig } from "drizzle-kit";
|
|
3
3
|
|
|
4
|
-
if (
|
|
4
|
+
if (!$$.BATI.hasD1) {
|
|
5
5
|
if (!process.env.DATABASE_URL) {
|
|
6
6
|
throw new Error("Missing DATABASE_URL in .env file");
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export default defineConfig({
|
|
11
|
-
dialect: BATI.has("postgres") ? "postgresql" : "sqlite",
|
|
11
|
+
dialect: $$.BATI.has("postgres") ? "postgresql" : "sqlite",
|
|
12
12
|
schema: "./database/drizzle/schema/*",
|
|
13
13
|
out: "./database/migrations",
|
|
14
|
-
|
|
14
|
+
// !$$.BATI.hasD1
|
|
15
15
|
dbCredentials: {
|
|
16
16
|
// biome-ignore lint/style/noNonNullAssertion: exists
|
|
17
17
|
url: process.env.DATABASE_URL!,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { dbD1, dbPostgres, dbSqlite } from "../db.mjs";
|
|
2
2
|
|
|
3
3
|
//#region files/database/drizzle/queries/todos.d.ts
|
|
4
|
-
declare function insertTodo(db:
|
|
5
|
-
'BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
6
|
-
"
|
|
4
|
+
declare function insertTodo(db: $$.If<{
|
|
5
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
6
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbSqlite>;
|
|
7
7
|
_: ReturnType<typeof dbD1>;
|
|
8
8
|
}>, text: string): any;
|
|
9
|
-
declare function getAllTodos(db:
|
|
10
|
-
'BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
11
|
-
"
|
|
9
|
+
declare function getAllTodos(db: $$.If<{
|
|
10
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbPostgres>;
|
|
11
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbSqlite>;
|
|
12
12
|
_: ReturnType<typeof dbD1>;
|
|
13
13
|
}, "union">): Promise<any>;
|
|
14
14
|
//#endregion
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { addVitePlugin,
|
|
3
|
+
import { addVitePlugin, transformConfig } from "@batijs/core";
|
|
4
4
|
//#region ../../boilerplates/edgeone/dist/files/$vite.config.ts.mjs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
function getViteConfig(props) {
|
|
6
|
+
return transformConfig(props, (root) => {
|
|
7
|
+
addVitePlugin(root, {
|
|
8
|
+
from: "@edgeone/vite",
|
|
9
|
+
constructor: "edgeone"
|
|
10
|
+
});
|
|
10
11
|
});
|
|
11
|
-
return mod.generate().code;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
14
|
export { getViteConfig as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// (BATI.has("auth0") || BATI.hasDatabase) &&
|
|
1
|
+
// ($$.BATI.has("auth0") || $$.BATI.hasDatabase) && !$$.BATI.has("cloudflare")
|
|
2
2
|
import "@batijs/shared-env/server/load";
|
|
3
3
|
import type { Server } from "vike/types";
|
|
4
4
|
import { app } from "./server/elysia";
|
|
@@ -12,31 +12,31 @@ function getApp() {
|
|
|
12
12
|
const app = new Elysia();
|
|
13
13
|
|
|
14
14
|
vike(app, [
|
|
15
|
-
|
|
15
|
+
// $$.BATI.hasDbDemo
|
|
16
16
|
// Make database available in Context as `context.db`
|
|
17
17
|
dbMiddleware,
|
|
18
|
-
|
|
18
|
+
// $$.BATI.has("authjs") || $$.BATI.has("auth0")
|
|
19
19
|
// Append Auth.js session to context
|
|
20
20
|
authjsSessionMiddleware,
|
|
21
|
-
|
|
21
|
+
// $$.BATI.has("authjs") || $$.BATI.has("auth0")
|
|
22
22
|
// Auth.js route. See https://authjs.dev/getting-started/installation
|
|
23
23
|
authjsHandler,
|
|
24
|
-
|
|
24
|
+
// $$.BATI.has("better-auth")
|
|
25
25
|
// Append Better Auth user to context
|
|
26
26
|
betterAuthSessionMiddleware,
|
|
27
|
-
|
|
27
|
+
// $$.BATI.has("better-auth")
|
|
28
28
|
// Better Auth route. See https://better-auth.com/docs/installation
|
|
29
29
|
betterAuthHandler,
|
|
30
|
-
|
|
30
|
+
// $$.BATI.has("trpc")
|
|
31
31
|
// tRPC route. See https://trpc.io/docs/server/adapters
|
|
32
32
|
trpcHandler("/api/trpc"),
|
|
33
|
-
|
|
33
|
+
// $$.BATI.has("telefunc")
|
|
34
34
|
// Telefunc route. See https://telefunc.com
|
|
35
35
|
telefuncHandler,
|
|
36
|
-
|
|
36
|
+
// $$.BATI.has("ts-rest")
|
|
37
37
|
// ts-rest route. See https://ts-rest.com
|
|
38
38
|
tsRestHandler,
|
|
39
|
-
|
|
39
|
+
// !$$.BATI.has("telefunc") && !$$.BATI.has("trpc") && !$$.BATI.has("ts-rest")
|
|
40
40
|
createTodoHandler,
|
|
41
41
|
]);
|
|
42
42
|
|
|
@@ -13,17 +13,17 @@ export default tseslint.config(
|
|
|
13
13
|
"dist/*",
|
|
14
14
|
// Temporary compiled files
|
|
15
15
|
"**/*.ts.build-*.mjs",
|
|
16
|
-
|
|
16
|
+
// $$.BATI.has("vercel")
|
|
17
17
|
".vercel/*",
|
|
18
|
-
|
|
18
|
+
// $$.BATI.has("aws")
|
|
19
19
|
"cdk.out/*",
|
|
20
|
-
|
|
20
|
+
// $$.BATI.has("edgeone")
|
|
21
21
|
".edgeone",
|
|
22
|
-
|
|
22
|
+
// $$.BATI.has("netlify")
|
|
23
23
|
".netlify",
|
|
24
|
-
|
|
24
|
+
// $$.BATI.has("cloudflare")
|
|
25
25
|
"worker-configuration.d.ts",
|
|
26
|
-
|
|
26
|
+
// $$.BATI.has("storybook")
|
|
27
27
|
"stories/*",
|
|
28
28
|
// JS files at the root of the project
|
|
29
29
|
"*.js",
|
|
@@ -53,7 +53,7 @@ export default tseslint.config(
|
|
|
53
53
|
"@typescript-eslint/no-namespace": 0,
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
// $$.BATI.has("vue")
|
|
57
57
|
{
|
|
58
58
|
files: ["**/*.vue"],
|
|
59
59
|
languageOptions: {
|
|
@@ -65,7 +65,7 @@ export default tseslint.config(
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
|
-
|
|
68
|
+
// $$.BATI.has("react")
|
|
69
69
|
{
|
|
70
70
|
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
|
|
71
71
|
...react.configs.flat.recommended,
|
|
@@ -83,9 +83,9 @@ export default tseslint.config(
|
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
} as ConfigArray[number],
|
|
86
|
-
|
|
86
|
+
// $$.BATI.has("react")
|
|
87
87
|
react.configs.flat["jsx-runtime"] as ConfigArray[number],
|
|
88
|
-
|
|
88
|
+
// $$.BATI.has("solid")
|
|
89
89
|
{
|
|
90
90
|
files: ["**/*.{ts,tsx,js,jsx}"],
|
|
91
91
|
...solid,
|
|
@@ -97,9 +97,9 @@ export default tseslint.config(
|
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
|
-
|
|
100
|
+
// $$.BATI.has("vue")
|
|
101
101
|
...(pluginVue.configs["flat/recommended"] as ConfigArray),
|
|
102
|
-
|
|
102
|
+
// $$.BATI.has("vue")
|
|
103
103
|
{
|
|
104
104
|
rules: {
|
|
105
105
|
"vue/multi-word-component-names": "off",
|
|
@@ -114,7 +114,7 @@ export default tseslint.config(
|
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
116
|
},
|
|
117
|
-
|
|
117
|
+
// $$.BATI.has("compiled-css")
|
|
118
118
|
{
|
|
119
119
|
rules: {
|
|
120
120
|
"react/no-unknown-property": [
|
|
@@ -125,6 +125,6 @@ export default tseslint.config(
|
|
|
125
125
|
],
|
|
126
126
|
},
|
|
127
127
|
},
|
|
128
|
-
|
|
128
|
+
// $$.BATI.has("prettier")
|
|
129
129
|
prettier as ConfigArray[number],
|
|
130
130
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// BATI.has("auth0") || BATI.hasDatabase
|
|
1
|
+
// $$.BATI.has("auth0") || $$.BATI.hasDatabase
|
|
2
2
|
import "@batijs/shared-env/server/load";
|
|
3
3
|
import { authjsHandler, authjsSessionMiddleware } from "@batijs/authjs/server/authjs-handler";
|
|
4
4
|
import { betterAuthHandler, betterAuthSessionMiddleware } from "@batijs/better-auth/server/better-auth-handler";
|
|
@@ -17,31 +17,31 @@ function getHandler() {
|
|
|
17
17
|
const app = express();
|
|
18
18
|
|
|
19
19
|
vike(app, [
|
|
20
|
-
|
|
20
|
+
// $$.BATI.hasDbDemo
|
|
21
21
|
// Make database available in Context as `context.db`
|
|
22
22
|
dbMiddleware,
|
|
23
|
-
|
|
23
|
+
// $$.BATI.has("authjs") || $$.BATI.has("auth0")
|
|
24
24
|
// Append Auth.js session to context
|
|
25
25
|
authjsSessionMiddleware,
|
|
26
|
-
|
|
26
|
+
// $$.BATI.has("authjs") || $$.BATI.has("auth0")
|
|
27
27
|
// Auth.js route. See https://authjs.dev/getting-started/installation
|
|
28
28
|
authjsHandler,
|
|
29
|
-
|
|
29
|
+
// $$.BATI.has("better-auth")
|
|
30
30
|
// Append Better Auth user to context
|
|
31
31
|
betterAuthSessionMiddleware,
|
|
32
|
-
|
|
32
|
+
// $$.BATI.has("better-auth")
|
|
33
33
|
// Better Auth route. See https://better-auth.com/docs/installation
|
|
34
34
|
betterAuthHandler,
|
|
35
|
-
|
|
35
|
+
// $$.BATI.has("trpc")
|
|
36
36
|
// tRPC route. See https://trpc.io/docs/server/adapters
|
|
37
37
|
trpcHandler("/api/trpc"),
|
|
38
|
-
|
|
38
|
+
// $$.BATI.has("telefunc")
|
|
39
39
|
// Telefunc route. See https://telefunc.com
|
|
40
40
|
telefuncHandler,
|
|
41
|
-
|
|
41
|
+
// $$.BATI.has("ts-rest")
|
|
42
42
|
// ts-rest route. See https://ts-rest.com
|
|
43
43
|
tsRestHandler,
|
|
44
|
-
|
|
44
|
+
// !$$.BATI.has("telefunc") && !$$.BATI.has("trpc") && !$$.BATI.has("ts-rest")
|
|
45
45
|
createTodoHandler,
|
|
46
46
|
]);
|
|
47
47
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// BATI.has("auth0") || BATI.hasDatabase
|
|
1
|
+
// $$.BATI.has("auth0") || $$.BATI.hasDatabase
|
|
2
2
|
import "@batijs/shared-env/server/load";
|
|
3
3
|
import { authjsHandler, authjsSessionMiddleware } from "@batijs/authjs/server/authjs-handler";
|
|
4
4
|
import { betterAuthHandler, betterAuthSessionMiddleware } from "@batijs/better-auth/server/better-auth-handler";
|
|
@@ -24,31 +24,31 @@ async function getHandler() {
|
|
|
24
24
|
await app.register(rawBody);
|
|
25
25
|
|
|
26
26
|
await vike(app, [
|
|
27
|
-
|
|
27
|
+
// $$.BATI.hasDbDemo
|
|
28
28
|
// Make database available in Context as `context.db`
|
|
29
29
|
dbMiddleware,
|
|
30
|
-
|
|
30
|
+
// $$.BATI.has("authjs") || $$.BATI.has("auth0")
|
|
31
31
|
// Append Auth.js session to context
|
|
32
32
|
authjsSessionMiddleware,
|
|
33
|
-
|
|
33
|
+
// $$.BATI.has("authjs") || $$.BATI.has("auth0")
|
|
34
34
|
// Auth.js route. See https://authjs.dev/getting-started/installation
|
|
35
35
|
authjsHandler,
|
|
36
|
-
|
|
36
|
+
// $$.BATI.has("better-auth")
|
|
37
37
|
// Append Better Auth user to context
|
|
38
38
|
betterAuthSessionMiddleware,
|
|
39
|
-
|
|
39
|
+
// $$.BATI.has("better-auth")
|
|
40
40
|
// Better Auth route. See https://better-auth.com/docs/installation
|
|
41
41
|
betterAuthHandler,
|
|
42
|
-
|
|
42
|
+
// $$.BATI.has("trpc")
|
|
43
43
|
// tRPC route. See https://trpc.io/docs/server/adapters
|
|
44
44
|
trpcHandler("/api/trpc"),
|
|
45
|
-
|
|
45
|
+
// $$.BATI.has("telefunc")
|
|
46
46
|
// Telefunc route. See https://telefunc.com
|
|
47
47
|
telefuncHandler,
|
|
48
|
-
|
|
48
|
+
// $$.BATI.has("ts-rest")
|
|
49
49
|
// ts-rest route. See https://ts-rest.com
|
|
50
50
|
tsRestHandler,
|
|
51
|
-
|
|
51
|
+
// !$$.BATI.has("telefunc") && !$$.BATI.has("trpc") && !$$.BATI.has("ts-rest")
|
|
52
52
|
createTodoHandler,
|
|
53
53
|
]);
|
|
54
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// (BATI.has("auth0") || BATI.hasDatabase) &&
|
|
1
|
+
// ($$.BATI.has("auth0") || $$.BATI.hasDatabase) && !$$.BATI.has("cloudflare")
|
|
2
2
|
import "@batijs/shared-env/server/load";
|
|
3
3
|
import type { Server } from "vike/types";
|
|
4
4
|
import { app } from "./server/hono";
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
fetch: app.fetch,
|
|
11
11
|
prod: {
|
|
12
12
|
port,
|
|
13
|
-
|
|
13
|
+
// $$.BATI.has("aws")
|
|
14
14
|
// We need to override static root config when deploying to AWS
|
|
15
15
|
static: `${process.cwd()}/dist/client`,
|
|
16
16
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// $$.keepFileIf($$.BATI.has("aws"))
|
|
2
2
|
/*
|
|
3
3
|
entry_aws_lambda.ts
|
|
4
4
|
|
|
@@ -8,7 +8,6 @@ Notes:
|
|
|
8
8
|
* The file name must not have any special characters or dots except for the extension. https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunction.html#API_CreateFunction_RequestSyntax
|
|
9
9
|
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
11
|
import type { Handler } from "aws-lambda";
|
|
13
12
|
import { Hono } from "hono";
|
|
14
13
|
import type { LambdaContext, LambdaEvent } from "hono/aws-lambda";
|
|
@@ -25,4 +24,3 @@ const lambdaApp = new Hono<{ Bindings: Bindings }>();
|
|
|
25
24
|
|
|
26
25
|
lambdaApp.route("/", app as Hono);
|
|
27
26
|
export const handler: Handler = handle(lambdaApp);
|
|
28
|
-
/*{ /if }*/
|