@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
|
@@ -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 };
|
|
@@ -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,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
|
|
|
@@ -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
|
|
@@ -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
|
);
|
|
@@ -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,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
|
|
|
@@ -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,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
|
|
|
@@ -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,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 }*/
|
|
@@ -12,31 +12,31 @@ function getApp() {
|
|
|
12
12
|
const app = new Hono();
|
|
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
|
|
|
@@ -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,7 @@ var bati_config_default = t({
|
|
|
11
11
|
if(meta) {
|
|
12
12
|
return meta.BATI.has("kysely");
|
|
13
13
|
},
|
|
14
|
+
deploy: ["database/kysely/migrations"],
|
|
14
15
|
nextSteps(meta, packageManager, { bold }) {
|
|
15
16
|
if (meta.BATI.hasD1) return [];
|
|
16
17
|
return [{
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { addVitePlugin,
|
|
3
|
+
import { addVitePlugin, transformConfig } from "@batijs/core";
|
|
4
4
|
//#region ../../boilerplates/kysely/dist/files/$vite.config.ts.mjs
|
|
5
|
-
|
|
5
|
+
function getViteConfig(props) {
|
|
6
6
|
if (props.meta.BATI.hasD1) return;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
entry: "database/kysely/migrate.ts"
|
|
15
|
-
}
|
|
7
|
+
return transformConfig(props, (root) => {
|
|
8
|
+
addVitePlugin(root, {
|
|
9
|
+
from: "./vite-plugin-input.js",
|
|
10
|
+
constructor: "inputPlugin",
|
|
11
|
+
named: true,
|
|
12
|
+
options: `{ name: "migrate", entry: "database/kysely/migrate.ts" }`
|
|
13
|
+
});
|
|
16
14
|
});
|
|
17
|
-
return mod.generate().code;
|
|
18
15
|
}
|
|
19
16
|
//#endregion
|
|
20
17
|
export { getViteConfig as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/* $$.keepFileIfImported */
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// !$$.BATI.hasD1
|
|
4
4
|
import "@batijs/shared-env/server/load";
|
|
5
5
|
import SQLite from "better-sqlite3";
|
|
6
6
|
import { Kysely, SqliteDialect } from "kysely";
|
|
@@ -9,7 +9,7 @@ import { PostgresJSDialect } from "kysely-postgres-js";
|
|
|
9
9
|
import postgres from "postgres";
|
|
10
10
|
import type { Database } from "./types";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// $$.BATI.has("sqlite") && !$$.BATI.hasD1
|
|
13
13
|
export function dbKysely() {
|
|
14
14
|
const dialect = new SqliteDialect({
|
|
15
15
|
database: new SQLite(process.env.DATABASE_URL),
|
|
@@ -19,14 +19,14 @@ export function dbKysely() {
|
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
// $$.BATI.hasD1
|
|
23
23
|
export function dbKyselyD1(d1: D1Database) {
|
|
24
24
|
return new Kysely<Database>({
|
|
25
25
|
dialect: new D1Dialect({ database: d1 }),
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// $$.BATI.has("postgres")
|
|
30
30
|
export function dbKyselyPostgres() {
|
|
31
31
|
if (!process.env.DATABASE_URL) {
|
|
32
32
|
throw new Error("Missing DATABASE_URL in .env file");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// $$.keepFileIf(!$$.BATI.hasD1)
|
|
3
2
|
import * as fs from "node:fs/promises";
|
|
4
3
|
import * as path from "node:path";
|
|
5
4
|
import { dirname } from "node:path";
|
|
@@ -11,14 +10,15 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
11
10
|
const __dirname = dirname(__filename);
|
|
12
11
|
|
|
13
12
|
async function migrateToLatest() {
|
|
14
|
-
const db = BATI.has("postgres") ? dbKyselyPostgres() : dbKysely();
|
|
13
|
+
const db = $$.BATI.has("postgres") ? dbKyselyPostgres() : dbKysely();
|
|
15
14
|
const migrator = new Migrator({
|
|
16
15
|
db,
|
|
17
16
|
provider: new FileMigrationProvider({
|
|
18
17
|
fs,
|
|
19
18
|
path,
|
|
20
|
-
//
|
|
21
|
-
|
|
19
|
+
// Absolute path required. The runner sits two levels deep in both dev (database/kysely/)
|
|
20
|
+
// and prod (bundled dist/server/), so ../.. reaches the app-root migration sources.
|
|
21
|
+
migrationFolder: path.join(__dirname, "../../database/kysely/migrations"),
|
|
22
22
|
}),
|
|
23
23
|
});
|
|
24
24
|
|
|
@@ -42,4 +42,3 @@ async function migrateToLatest() {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
await migrateToLatest();
|
|
45
|
-
/*{ /if }*/
|
package/dist/boilerplates/@batijs/kysely/files/database/kysely/migrations/001_create_todos_table.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// $$.keepFileIf(!$$.BATI.hasD1)
|
|
2
2
|
import type { Kysely } from "kysely";
|
|
3
3
|
import type { Database } from "../types";
|
|
4
4
|
|
|
5
5
|
export async function up(db: Kysely<Database>): Promise<void> {
|
|
6
|
-
const withId = BATI.has("postgres")
|
|
6
|
+
const withId = $$.BATI.has("postgres")
|
|
7
7
|
? db.schema.createTable("todos").addColumn("id", "serial", (col) => col.primaryKey())
|
|
8
8
|
: db.schema.createTable("todos").addColumn("id", "integer", (col) => col.primaryKey().autoIncrement());
|
|
9
9
|
await withId.addColumn("text", "text", (col) => col.notNull()).execute();
|
|
@@ -12,4 +12,3 @@ export async function up(db: Kysely<Database>): Promise<void> {
|
|
|
12
12
|
export async function down(db: Kysely<Database>): Promise<void> {
|
|
13
13
|
await db.schema.dropTable("todos").execute();
|
|
14
14
|
}
|
|
15
|
-
/*{ /if }*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { dbKysely, dbKyselyD1, dbKyselyPostgres } from "../db";
|
|
2
2
|
|
|
3
3
|
export async function insertTodo(
|
|
4
|
-
db:
|
|
5
|
-
'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
6
|
-
"
|
|
7
|
-
"BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
4
|
+
db: $$.If<{
|
|
5
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
6
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
|
|
7
|
+
"$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
8
8
|
}>,
|
|
9
9
|
text: string,
|
|
10
10
|
) {
|
|
@@ -12,10 +12,10 @@ export async function insertTodo(
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export async function getAllTodos(
|
|
15
|
-
db:
|
|
16
|
-
'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
17
|
-
"
|
|
18
|
-
"BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
15
|
+
db: $$.If<{
|
|
16
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
17
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
|
|
18
|
+
"$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
19
19
|
}>,
|
|
20
20
|
) {
|
|
21
21
|
return await db.selectFrom("todos").selectAll().execute();
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { dbKysely, dbKyselyD1, dbKyselyPostgres } from "../db.mjs";
|
|
2
2
|
|
|
3
3
|
//#region files/database/kysely/queries/todos.d.ts
|
|
4
|
-
declare function insertTodo(db:
|
|
5
|
-
'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
6
|
-
"
|
|
7
|
-
"BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
4
|
+
declare function insertTodo(db: $$.If<{
|
|
5
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
6
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
|
|
7
|
+
"$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
8
8
|
}>, text: string): Promise<{
|
|
9
9
|
id: number;
|
|
10
10
|
text: string;
|
|
11
11
|
}>;
|
|
12
|
-
declare function getAllTodos(db:
|
|
13
|
-
'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
14
|
-
"
|
|
15
|
-
"BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
12
|
+
declare function getAllTodos(db: $$.If<{
|
|
13
|
+
'$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
|
|
14
|
+
"!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
|
|
15
|
+
"$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
|
|
16
16
|
}>): Promise<{
|
|
17
17
|
id: number;
|
|
18
18
|
text: string;
|
|
@@ -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
|