@batijs/cli 0.0.649 → 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/auth0/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/authjs/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +1 -1
- package/dist/boilerplates/@batijs/aws/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/aws/files/cdk/bin/infrastructure.ts +1 -1
- package/dist/boilerplates/@batijs/better-auth/bati.config.mjs +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/biome/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/cloudflare/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +9 -9
- package/dist/boilerplates/@batijs/compiled/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +9 -9
- package/dist/boilerplates/@batijs/d1/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/d1-kysely/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/d1-sqlite/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/docker-compose/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/docker-compose/files/$Dockerfile.js +5 -44
- package/dist/boilerplates/@batijs/docker-compose/files/docker-compose.yml +6 -6
- package/dist/boilerplates/@batijs/dokploy/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/drizzle/bati.config.mjs +6 -1
- 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/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/edgeone/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/elysia/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/eslint/files/eslint.config.ts +14 -14
- package/dist/boilerplates/@batijs/express/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/express/files/+server.ts +10 -10
- package/dist/boilerplates/@batijs/fastify/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/fastify/files/+server.ts +10 -10
- package/dist/boilerplates/@batijs/google-analytics/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/hono/bati.config.mjs +1 -1
- 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/bati.config.mjs +2 -1
- 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 +5 -6
- 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/mantine/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/netlify/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/netlify/files/$vite.config.ts.js +8 -8
- package/dist/boilerplates/@batijs/oxlint/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/plausible.io/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/pnpm/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/postgres/bati.config.mjs +2 -1
- 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/prettier/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/prisma/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/react/bati.config.mjs +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/bati.config.mjs +1 -1
- 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/react-sentry/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/sentry/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +5 -27
- package/dist/boilerplates/@batijs/shared/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/shared/files/vite.config.ts +1 -1
- package/dist/boilerplates/@batijs/shared-db/bati.config.mjs +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/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- 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/solid-sentry/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/sqlite/bati.config.mjs +2 -1
- 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/storybook/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/bati.config.mjs +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/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +15 -15
- package/dist/boilerplates/@batijs/universal-deploy/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/vercel/bati.config.mjs +1 -1
- package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +8 -8
- package/dist/boilerplates/@batijs/vue/bati.config.mjs +1 -1
- 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/bati.config.mjs +1 -1
- 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/boilerplates/@batijs/vue-sentry/bati.config.mjs +1 -1
- package/dist/index.js +49 -47
- package/package.json +5 -5
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -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
|
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -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");
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -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 };
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -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 };
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -19,49 +19,10 @@ async function getDockerfile(props) {
|
|
|
19
19
|
const run = pm.run;
|
|
20
20
|
const config = dockerPackageManager(pm.name, { frozenLockfile: !meta.BATI_TEST });
|
|
21
21
|
const startupMigrations = [];
|
|
22
|
-
|
|
23
|
-
if (meta.BATI.has("
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
sources: ["/app/database/migrations"],
|
|
27
|
-
dest: "./database/migrations",
|
|
28
|
-
from: "deps-dev"
|
|
29
|
-
});
|
|
30
|
-
migrationCopies.push({
|
|
31
|
-
sources: ["/app/drizzle.config.ts"],
|
|
32
|
-
dest: "./drizzle.config.ts",
|
|
33
|
-
from: "builder"
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (meta.BATI.has("kysely")) {
|
|
37
|
-
startupMigrations.push(`${nodeCli} ./dist/server/migrate.mjs`);
|
|
38
|
-
migrationCopies.push({
|
|
39
|
-
sources: ["/app/database/kysely/migrations"],
|
|
40
|
-
dest: "./dist/server/migrations",
|
|
41
|
-
from: "builder"
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (meta.BATI.has("sqlite") && !meta.BATI.hasOrm) {
|
|
45
|
-
startupMigrations.push(`${run} sqlite:migrate`);
|
|
46
|
-
migrationCopies.push({
|
|
47
|
-
sources: ["/app/database/sqlite"],
|
|
48
|
-
dest: "./database/sqlite",
|
|
49
|
-
from: "builder"
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
if (meta.BATI.has("postgres") && !meta.BATI.hasOrm) {
|
|
53
|
-
startupMigrations.push(`${run} postgres:migrate`);
|
|
54
|
-
migrationCopies.push({
|
|
55
|
-
sources: ["/app/database/postgres"],
|
|
56
|
-
dest: "./database/postgres",
|
|
57
|
-
from: "builder"
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (meta.BATI.has("drizzle") || (meta.BATI.has("sqlite") || meta.BATI.has("postgres")) && !meta.BATI.hasOrm) migrationCopies.push({
|
|
61
|
-
sources: ["/app/server/load.ts"],
|
|
62
|
-
dest: "./server/load.ts",
|
|
63
|
-
from: "builder"
|
|
64
|
-
});
|
|
22
|
+
if (meta.BATI.has("drizzle")) startupMigrations.push(`${run} drizzle:migrate`);
|
|
23
|
+
if (meta.BATI.has("kysely")) startupMigrations.push(`${nodeCli} ./dist/server/migrate.mjs`);
|
|
24
|
+
if (meta.BATI.has("sqlite") && !meta.BATI.hasOrm) startupMigrations.push(`${run} sqlite:migrate`);
|
|
25
|
+
if (meta.BATI.has("postgres") && !meta.BATI.hasOrm) startupMigrations.push(`${run} postgres:migrate`);
|
|
65
26
|
const startCmd = startupMigrations.length > 0 ? [
|
|
66
27
|
"sh",
|
|
67
28
|
"-c",
|
|
@@ -86,7 +47,7 @@ async function getDockerfile(props) {
|
|
|
86
47
|
}).pipe((b) => {
|
|
87
48
|
for (const group of serverEnvDefaults(props.env)) b.env(group.vars, { comment: group.comment });
|
|
88
49
|
}).when(config.corepack, (b) => b.run("corepack enable")).copy(installSources, "./").copy(["/app/node_modules"], "./node_modules", { from: "deps-prod" }).copy(["/app/dist"], "./dist", { from: "builder" }).pipe((b) => {
|
|
89
|
-
for (const
|
|
50
|
+
for (const file of props.deploy) b.copy([`/app/${file}`], `./${file}`, { from: "deps-dev" });
|
|
90
51
|
}).expose(3e3).cmd(startCmd).build()}\n`;
|
|
91
52
|
}
|
|
92
53
|
//#endregion
|
|
@@ -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: {}
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|
|
@@ -11,6 +11,11 @@ var bati_config_default = t({
|
|
|
11
11
|
if(meta) {
|
|
12
12
|
return meta.BATI.has("drizzle");
|
|
13
13
|
},
|
|
14
|
+
deploy: [
|
|
15
|
+
"database/migrations",
|
|
16
|
+
"drizzle.config.ts",
|
|
17
|
+
"server/load.ts"
|
|
18
|
+
],
|
|
14
19
|
nextSteps(_meta, packageManager, { bold }) {
|
|
15
20
|
return [
|
|
16
21
|
{
|
|
@@ -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
|
|
@@ -3,7 +3,7 @@ function e(e, t) {
|
|
|
3
3
|
if (!e) throw Error(t);
|
|
4
4
|
}
|
|
5
5
|
function t(t) {
|
|
6
|
-
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), t;
|
|
6
|
+
return `enforce` in t && e(t.enforce === `pre` || t.enforce === `post`, `'enforce' must be 'pre' or 'post', was ${t.enforce}`), `if` in t && e(typeof t.if == `function`, `'if' must be a function`), `nextSteps` in t && e(typeof t.nextSteps == `function`, `'nextSteps' must be a function`), `knip` in t && (e(typeof t.knip == `object` && t.knip !== null, `'knip' must be an object`), `entry` in t.knip && e(Array.isArray(t.knip.entry), `'knip.entry' must be an array`), `ignoreDependencies` in t.knip && e(Array.isArray(t.knip.ignoreDependencies), `'knip.ignoreDependencies' must be an array`), `ignore` in t.knip && e(Array.isArray(t.knip.ignore), `'knip.ignore' must be an array`), `vite` in t.knip && e(typeof t.knip.vite == `boolean`, `'knip.vite' must be a boolean`)), `env` in t && e(typeof t.env == `function`, `'env' must be a function of meta`), `deploy` in t && e(Array.isArray(t.deploy) || typeof t.deploy == `function`, `'deploy' must be an array or a function of meta`), t;
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region bati.config.ts
|