@batijs/cli 0.0.259 → 0.0.261
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boilerplates/@batijs/authjs/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +2 -2
- package/dist/boilerplates/@batijs/authjs/types/server/authjs-handler.d.ts +2 -3
- package/dist/boilerplates/@batijs/aws/files/$README.md.js +109 -0
- package/dist/boilerplates/@batijs/aws/files/$package.json.js +138 -0
- package/dist/boilerplates/@batijs/aws/files/$tsconfig.json.js +15 -0
- package/dist/boilerplates/@batijs/aws/files/cdk/$stack-name-suffix.json.js +19 -0
- package/dist/boilerplates/@batijs/aws/files/cdk/bin/infrastructure.ts +85 -0
- package/dist/boilerplates/@batijs/aws/files/cdk/lib/vike-stack.ts +186 -0
- package/dist/boilerplates/@batijs/aws/files/cdk.json +72 -0
- package/dist/boilerplates/@batijs/aws/files/tests/aws_handler.spec.ts +116 -0
- package/dist/boilerplates/@batijs/aws/files/vitest.config.ts +8 -0
- package/dist/boilerplates/@batijs/aws/types/cdk/bin/infrastructure.d.ts +11 -0
- package/dist/boilerplates/@batijs/aws/types/cdk/lib/vike-stack.d.ts +13 -0
- package/dist/boilerplates/@batijs/aws/types/vitest.config.d.ts +2 -0
- package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +10 -0
- package/dist/boilerplates/@batijs/d1/files/$README.md.js +0 -4
- package/dist/boilerplates/@batijs/d1/files/$package.json.js +96 -0
- package/dist/boilerplates/@batijs/d1/files/$wrangler.toml.js +1 -0
- package/dist/boilerplates/@batijs/d1/files/database/d1/helpers.ts +17 -0
- package/dist/boilerplates/@batijs/d1/files/vike.d.ts +8 -0
- package/dist/boilerplates/@batijs/d1/types/database/d1/helpers.d.ts +6 -0
- package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +10 -0
- package/dist/boilerplates/@batijs/d1-sqlite/files/database/d1/queries/lucia-auth.ts +28 -0
- package/dist/boilerplates/@batijs/d1-sqlite/files/database/d1/queries/todos.ts +10 -0
- package/dist/boilerplates/@batijs/d1-sqlite/files/database/migrations/lucia-auth.sql +20 -0
- package/dist/boilerplates/@batijs/d1-sqlite/files/database/migrations/todos.sql +4 -0
- package/dist/boilerplates/@batijs/d1-sqlite/types/database/d1/queries/lucia-auth.d.ts +5 -0
- package/dist/boilerplates/@batijs/d1-sqlite/types/database/d1/queries/todos.d.ts +6 -0
- package/dist/boilerplates/@batijs/drizzle/files/$.env.js +1 -0
- package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +0 -3
- package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +7 -14
- package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/db.ts +10 -12
- package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/lucia-auth.ts +38 -9
- package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/todos.ts +16 -5
- package/dist/boilerplates/@batijs/drizzle/files/drizzle.config.ts +7 -4
- package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/db.d.ts +2 -2
- package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/lucia-auth.d.ts +19 -6
- package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/todos.d.ts +9 -2
- package/dist/boilerplates/@batijs/eslint/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/eslint/files/eslint.config.js +2 -1
- package/dist/boilerplates/@batijs/express/files/$package.json.js +2 -1
- package/dist/boilerplates/@batijs/express/files/express-entry.ts +13 -12
- package/dist/boilerplates/@batijs/fastify/files/$package.json.js +2 -1
- package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +17 -24
- package/dist/boilerplates/@batijs/firebase-auth/files/$package.json.js +2 -2
- package/dist/boilerplates/@batijs/firebase-auth/files/server/firebase-auth-middleware.ts +2 -2
- package/dist/boilerplates/@batijs/firebase-auth/types/server/firebase-auth-middleware.d.ts +2 -6
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +1 -0
- package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +12 -2
- package/dist/boilerplates/@batijs/hattip/files/$package.json.js +15 -2
- package/dist/boilerplates/@batijs/hattip/files/entry_aws_lambda.ts +37 -0
- package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +12 -12
- package/dist/boilerplates/@batijs/hattip/types/entry_aws_lambda.d.ts +2 -0
- package/dist/boilerplates/@batijs/hono/files/$package.json.js +22 -4
- package/dist/boilerplates/@batijs/hono/files/entry_aws_lambda.ts +37 -0
- package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +12 -12
- package/dist/boilerplates/@batijs/hono/types/entry_aws_lambda.d.ts +3 -0
- package/dist/boilerplates/@batijs/lucia-auth/files/$package.json.js +4 -1
- package/dist/boilerplates/@batijs/lucia-auth/files/lib/lucia-auth.ts +75 -39
- package/dist/boilerplates/@batijs/lucia-auth/files/server/lucia-auth-handlers.ts +77 -33
- package/dist/boilerplates/@batijs/lucia-auth/types/lib/lucia-auth.d.ts +30 -10
- package/dist/boilerplates/@batijs/lucia-auth/types/server/lucia-auth-handlers.d.ts +13 -13
- package/dist/boilerplates/@batijs/react-lucia-auth/files/pages/login/+Page.tsx +2 -1
- package/dist/boilerplates/@batijs/shared/files/vite.config.ts +6 -0
- package/dist/boilerplates/@batijs/shared-db/files/server/db-middleware.ts +37 -0
- package/dist/boilerplates/@batijs/shared-db/types/server/db-middleware.d.ts +17 -0
- package/dist/boilerplates/@batijs/shared-no-db/files/$package.json.js +2 -1
- package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +5 -2
- package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +22 -4
- package/dist/boilerplates/@batijs/shared-server/files/server/vike-handler.ts +2 -2
- package/dist/boilerplates/@batijs/shared-server/types/server/create-todo-handler.d.ts +19 -1
- package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+data.ts +10 -4
- package/dist/boilerplates/@batijs/shared-todo/files/vike.d.ts +19 -0
- package/dist/boilerplates/@batijs/shared-todo/types/pages/todo/+data.d.ts +2 -1
- package/dist/boilerplates/@batijs/solid-lucia-auth/files/pages/login/+Page.tsx +2 -1
- package/dist/boilerplates/@batijs/sqlite/files/$.env.js +1 -0
- package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +10 -1
- package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/queries/lucia-auth.ts +16 -15
- package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/queries/todos.ts +5 -5
- package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/queries/lucia-auth.d.ts +5 -5
- package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/queries/todos.d.ts +3 -2
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +5 -3
- package/dist/boilerplates/@batijs/telefunc/files/pages/todo/TodoList.telefunc.ts +10 -3
- package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +15 -2
- package/dist/boilerplates/@batijs/telefunc/files/vike.d.ts +20 -0
- package/dist/boilerplates/@batijs/trpc/files/$package.json.js +10 -7
- package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +22 -0
- package/dist/boilerplates/@batijs/trpc/files/trpc/server.ts +20 -4
- package/dist/boilerplates/@batijs/trpc/types/server/trpc-handler.d.ts +1 -0
- package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +36 -4
- package/dist/boilerplates/@batijs/trpc/types/trpc/server.d.ts +75 -8
- package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +4 -3
- package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +48 -27
- package/dist/boilerplates/@batijs/vue-lucia-auth/files/pages/login/+Page.vue +2 -1
- package/dist/boilerplates/boilerplates.json +61 -3
- package/dist/index.js +6 -1
- package/package.json +5 -5
- package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/seed.ts +0 -13
- package/dist/boilerplates/@batijs/trpc/files/$vite.config.ts.js +0 -13
- package/dist/boilerplates/@batijs/trpc/files/trpc/vite-plugin.ts +0 -49
- package/dist/boilerplates/@batijs/trpc/types/trpc/vite-plugin.d.ts +0 -12
- /package/dist/boilerplates/@batijs/{drizzle/types/database/drizzle/seed.d.ts → aws/types/tests/aws_handler.spec.d.ts} +0 -0
|
@@ -1,21 +1,48 @@
|
|
|
1
|
+
import type { dbD1, dbSqlite } from "@batijs/drizzle/database/drizzle/db";
|
|
2
|
+
import type { db as sqliteDb } from "@batijs/sqlite/database/sqlite/db";
|
|
3
|
+
import { D1Database } from "@cloudflare/workers-types";
|
|
1
4
|
/**
|
|
2
5
|
* Export reusable router and procedure helpers
|
|
3
6
|
* that can be used throughout the router
|
|
4
7
|
*/
|
|
5
8
|
export declare const router: <TProcRouterRecord extends import("@trpc/server").ProcedureRouterRecord>(procedures: TProcRouterRecord) => import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
6
|
-
ctx: object
|
|
9
|
+
ctx: object & {
|
|
10
|
+
db: ReturnType<typeof sqliteDb>;
|
|
11
|
+
} & {
|
|
12
|
+
db: ReturnType<typeof dbSqlite>;
|
|
13
|
+
} & {
|
|
14
|
+
db: ReturnType<typeof dbD1>;
|
|
15
|
+
} & {
|
|
16
|
+
db: D1Database;
|
|
17
|
+
};
|
|
7
18
|
meta: object;
|
|
8
19
|
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
9
20
|
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
10
21
|
}>, TProcRouterRecord>;
|
|
11
22
|
export declare const publicProcedure: import("@trpc/server").ProcedureBuilder<{
|
|
12
23
|
_config: import("@trpc/server").RootConfig<{
|
|
13
|
-
ctx: object
|
|
24
|
+
ctx: object & {
|
|
25
|
+
db: ReturnType<typeof sqliteDb>;
|
|
26
|
+
} & {
|
|
27
|
+
db: ReturnType<typeof dbSqlite>;
|
|
28
|
+
} & {
|
|
29
|
+
db: ReturnType<typeof dbD1>;
|
|
30
|
+
} & {
|
|
31
|
+
db: D1Database;
|
|
32
|
+
};
|
|
14
33
|
meta: object;
|
|
15
34
|
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
16
35
|
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
17
36
|
}>;
|
|
18
|
-
_ctx_out: object
|
|
37
|
+
_ctx_out: object & {
|
|
38
|
+
db: ReturnType<typeof sqliteDb>;
|
|
39
|
+
} & {
|
|
40
|
+
db: ReturnType<typeof dbSqlite>;
|
|
41
|
+
} & {
|
|
42
|
+
db: ReturnType<typeof dbD1>;
|
|
43
|
+
} & {
|
|
44
|
+
db: D1Database;
|
|
45
|
+
};
|
|
19
46
|
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
20
47
|
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
21
48
|
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
@@ -23,19 +50,43 @@ export declare const publicProcedure: import("@trpc/server").ProcedureBuilder<{
|
|
|
23
50
|
_meta: object;
|
|
24
51
|
}>;
|
|
25
52
|
export declare const appRouter: import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
26
|
-
ctx: object
|
|
53
|
+
ctx: object & {
|
|
54
|
+
db: ReturnType<typeof sqliteDb>;
|
|
55
|
+
} & {
|
|
56
|
+
db: ReturnType<typeof dbSqlite>;
|
|
57
|
+
} & {
|
|
58
|
+
db: ReturnType<typeof dbD1>;
|
|
59
|
+
} & {
|
|
60
|
+
db: D1Database;
|
|
61
|
+
};
|
|
27
62
|
meta: object;
|
|
28
63
|
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
29
64
|
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
30
65
|
}>, {
|
|
31
66
|
demo: import("@trpc/server").BuildProcedure<"query", {
|
|
32
67
|
_config: import("@trpc/server").RootConfig<{
|
|
33
|
-
ctx: object
|
|
68
|
+
ctx: object & {
|
|
69
|
+
db: ReturnType<typeof sqliteDb>;
|
|
70
|
+
} & {
|
|
71
|
+
db: ReturnType<typeof dbSqlite>;
|
|
72
|
+
} & {
|
|
73
|
+
db: ReturnType<typeof dbD1>;
|
|
74
|
+
} & {
|
|
75
|
+
db: D1Database;
|
|
76
|
+
};
|
|
34
77
|
meta: object;
|
|
35
78
|
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
36
79
|
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
37
80
|
}>;
|
|
38
|
-
_ctx_out: object
|
|
81
|
+
_ctx_out: object & {
|
|
82
|
+
db: ReturnType<typeof sqliteDb>;
|
|
83
|
+
} & {
|
|
84
|
+
db: ReturnType<typeof dbSqlite>;
|
|
85
|
+
} & {
|
|
86
|
+
db: ReturnType<typeof dbD1>;
|
|
87
|
+
} & {
|
|
88
|
+
db: D1Database;
|
|
89
|
+
};
|
|
39
90
|
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
40
91
|
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
41
92
|
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
@@ -46,13 +97,29 @@ export declare const appRouter: import("@trpc/server").CreateRouterInner<import(
|
|
|
46
97
|
}>;
|
|
47
98
|
onNewTodo: import("@trpc/server").BuildProcedure<"mutation", {
|
|
48
99
|
_config: import("@trpc/server").RootConfig<{
|
|
49
|
-
ctx: object
|
|
100
|
+
ctx: object & {
|
|
101
|
+
db: ReturnType<typeof sqliteDb>;
|
|
102
|
+
} & {
|
|
103
|
+
db: ReturnType<typeof dbSqlite>;
|
|
104
|
+
} & {
|
|
105
|
+
db: ReturnType<typeof dbD1>;
|
|
106
|
+
} & {
|
|
107
|
+
db: D1Database;
|
|
108
|
+
};
|
|
50
109
|
meta: object;
|
|
51
110
|
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
52
111
|
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
53
112
|
}>;
|
|
54
113
|
_meta: object;
|
|
55
|
-
_ctx_out: object
|
|
114
|
+
_ctx_out: object & {
|
|
115
|
+
db: ReturnType<typeof sqliteDb>;
|
|
116
|
+
} & {
|
|
117
|
+
db: ReturnType<typeof dbSqlite>;
|
|
118
|
+
} & {
|
|
119
|
+
db: ReturnType<typeof dbD1>;
|
|
120
|
+
} & {
|
|
121
|
+
db: D1Database;
|
|
122
|
+
};
|
|
56
123
|
_input_in: string;
|
|
57
124
|
_input_out: string;
|
|
58
125
|
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
@@ -43,12 +43,14 @@ var require_package = __commonJS({
|
|
|
43
43
|
devDependencies: {
|
|
44
44
|
"@batijs/compile": "workspace:*",
|
|
45
45
|
"@batijs/drizzle": "workspace:*",
|
|
46
|
+
"@batijs/d1": "workspace:*",
|
|
47
|
+
"@batijs/d1-sqlite": "workspace:*",
|
|
46
48
|
"@batijs/sqlite": "workspace:*",
|
|
47
|
-
"@
|
|
49
|
+
"@cloudflare/workers-types": "^4.20240821.1",
|
|
48
50
|
"@ts-rest/core": "^3.51.0",
|
|
49
51
|
"@ts-rest/serverless": "^3.51.0",
|
|
50
52
|
"@types/node": "^18.19.14",
|
|
51
|
-
"@universal-middleware/core": "^0.2.
|
|
53
|
+
"@universal-middleware/core": "^0.2.6",
|
|
52
54
|
zod: "^3.23.8"
|
|
53
55
|
},
|
|
54
56
|
dependencies: {
|
|
@@ -98,7 +100,6 @@ async function getPackageJson(props) {
|
|
|
98
100
|
dependencies: ["@ts-rest/core", "@ts-rest/serverless", "@universal-middleware/core"],
|
|
99
101
|
devDependencies: ["zod"]
|
|
100
102
|
});
|
|
101
|
-
packageJson.devDependencies.typescript = "~5.4.5";
|
|
102
103
|
return packageJson;
|
|
103
104
|
}
|
|
104
105
|
export {
|
|
@@ -2,44 +2,65 @@ import { fetchRequestHandler, tsr } from "@ts-rest/serverless/fetch";
|
|
|
2
2
|
import { contract } from "../ts-rest/contract";
|
|
3
3
|
import { Get, UniversalHandler } from "@universal-middleware/core";
|
|
4
4
|
import * as drizzleQueries from "@batijs/drizzle/database/drizzle/queries/todos";
|
|
5
|
+
import { dbD1, dbSqlite } from "@batijs/drizzle/database/drizzle/db";
|
|
5
6
|
import * as sqliteQueries from "@batijs/sqlite/database/sqlite/queries/todos";
|
|
7
|
+
import { db as sqliteDb } from "@batijs/sqlite/database/sqlite/db";
|
|
8
|
+
import * as d1Queries from "@batijs/d1-sqlite/database/d1/queries/todos";
|
|
9
|
+
import type { D1Database } from "@cloudflare/workers-types";
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* ts-rest route
|
|
9
13
|
*
|
|
10
14
|
* @link {@see https://ts-rest.com/docs/serverless/fetch-runtimes/}
|
|
11
15
|
**/
|
|
12
|
-
const router = tsr
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
16
|
+
const router = tsr
|
|
17
|
+
.platformContext<
|
|
18
|
+
BATI.If<{
|
|
19
|
+
'BATI.has("sqlite") && !BATI.hasD1': { db: ReturnType<typeof sqliteDb> };
|
|
20
|
+
'BATI.has("drizzle") && !BATI.hasD1': { db: ReturnType<typeof dbSqlite> };
|
|
21
|
+
'BATI.has("drizzle")': { db: ReturnType<typeof dbD1> };
|
|
22
|
+
"BATI.hasD1": { db: D1Database };
|
|
23
|
+
_: object;
|
|
24
|
+
}>
|
|
25
|
+
>()
|
|
26
|
+
.router(contract, {
|
|
27
|
+
demo: async () => {
|
|
28
|
+
return {
|
|
29
|
+
status: 200,
|
|
30
|
+
body: {
|
|
31
|
+
demo: true,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
createTodo: async ({ body }, _ctx) => {
|
|
36
|
+
if (BATI.has("drizzle")) {
|
|
37
|
+
await drizzleQueries.insertTodo(_ctx.db, body.text);
|
|
38
|
+
} else if (BATI.has("sqlite") && !BATI.hasD1) {
|
|
39
|
+
sqliteQueries.insertTodo(_ctx.db, body.text);
|
|
40
|
+
} else if (BATI.hasD1) {
|
|
41
|
+
await d1Queries.insertTodo(_ctx.db, body.text);
|
|
42
|
+
} else {
|
|
43
|
+
// This is where you'd persist the data
|
|
44
|
+
console.log("Received new todo", { text: body.text });
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
status: 200,
|
|
48
|
+
body: {
|
|
49
|
+
status: "Ok",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
});
|
|
38
54
|
|
|
39
|
-
export const tsRestHandler: Get<[], UniversalHandler> = () => async (request) =>
|
|
55
|
+
export const tsRestHandler: Get<[], UniversalHandler> = () => async (request, ctx, runtime) =>
|
|
40
56
|
fetchRequestHandler({
|
|
41
57
|
request: new Request(request.url, request),
|
|
42
58
|
contract,
|
|
43
59
|
router,
|
|
44
60
|
options: {},
|
|
61
|
+
platformContext: {
|
|
62
|
+
...ctx,
|
|
63
|
+
...runtime,
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
+
} as any,
|
|
45
66
|
});
|
|
@@ -73,7 +73,8 @@ async function handleOnSubmit(action: "login" | "signup") {
|
|
|
73
73
|
body: JSON.stringify(formData.value),
|
|
74
74
|
headers: { "Content-Type": "application/json" },
|
|
75
75
|
});
|
|
76
|
-
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
+
const result: Record<string, any> = await response.json();
|
|
77
78
|
if ("error" in result) {
|
|
78
79
|
console.error("A validation error has occurred :", result.error);
|
|
79
80
|
error.value = { ...result.error };
|
|
@@ -26,6 +26,17 @@
|
|
|
26
26
|
"files"
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"config": {
|
|
31
|
+
"if": {
|
|
32
|
+
"flag": "aws"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"folder": "@batijs/aws",
|
|
36
|
+
"subfolders": [
|
|
37
|
+
"files"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
29
40
|
{
|
|
30
41
|
"config": {
|
|
31
42
|
"if": {
|
|
@@ -63,8 +74,11 @@
|
|
|
63
74
|
"config": {
|
|
64
75
|
"if": {
|
|
65
76
|
"flag": {
|
|
77
|
+
"$in": [
|
|
78
|
+
"drizzle",
|
|
79
|
+
"sqlite"
|
|
80
|
+
],
|
|
66
81
|
"$all": [
|
|
67
|
-
"sqlite",
|
|
68
82
|
"cloudflare"
|
|
69
83
|
]
|
|
70
84
|
}
|
|
@@ -75,6 +89,22 @@
|
|
|
75
89
|
"files"
|
|
76
90
|
]
|
|
77
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"config": {
|
|
94
|
+
"if": {
|
|
95
|
+
"flag": {
|
|
96
|
+
"$all": [
|
|
97
|
+
"sqlite",
|
|
98
|
+
"cloudflare"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"folder": "@batijs/d1-sqlite",
|
|
104
|
+
"subfolders": [
|
|
105
|
+
"files"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
78
108
|
{
|
|
79
109
|
"config": {
|
|
80
110
|
"if": {
|
|
@@ -287,13 +317,32 @@
|
|
|
287
317
|
"files"
|
|
288
318
|
]
|
|
289
319
|
},
|
|
320
|
+
{
|
|
321
|
+
"config": {
|
|
322
|
+
"if": {
|
|
323
|
+
"flag": {
|
|
324
|
+
"$in": [
|
|
325
|
+
"drizzle",
|
|
326
|
+
"sqlite",
|
|
327
|
+
"edgedb",
|
|
328
|
+
"prisma"
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"folder": "@batijs/shared-db",
|
|
334
|
+
"subfolders": [
|
|
335
|
+
"files"
|
|
336
|
+
]
|
|
337
|
+
},
|
|
290
338
|
{
|
|
291
339
|
"config": {
|
|
292
340
|
"if": {
|
|
293
341
|
"flag": {
|
|
294
342
|
"$not": {
|
|
295
343
|
"$in": [
|
|
296
|
-
"drizzle"
|
|
344
|
+
"drizzle",
|
|
345
|
+
"sqlite"
|
|
297
346
|
]
|
|
298
347
|
}
|
|
299
348
|
}
|
|
@@ -400,7 +449,16 @@
|
|
|
400
449
|
{
|
|
401
450
|
"config": {
|
|
402
451
|
"if": {
|
|
403
|
-
"flag":
|
|
452
|
+
"flag": {
|
|
453
|
+
"$in": [
|
|
454
|
+
"sqlite"
|
|
455
|
+
],
|
|
456
|
+
"$not": {
|
|
457
|
+
"$in": [
|
|
458
|
+
"cloudflare"
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
}
|
|
404
462
|
}
|
|
405
463
|
},
|
|
406
464
|
"folder": "@batijs/sqlite",
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,7 @@ async function transformFileAfterExec(filepath, fileContent) {
|
|
|
98
98
|
case ".env.production.local":
|
|
99
99
|
case ".html":
|
|
100
100
|
case ".md":
|
|
101
|
+
case ".toml":
|
|
101
102
|
return fileContent;
|
|
102
103
|
case ".json":
|
|
103
104
|
return JSON.stringify(fileContent, null, 2);
|
|
@@ -1676,7 +1677,7 @@ var createDefaultQueryTester = function(query, options) {
|
|
|
1676
1677
|
// package.json
|
|
1677
1678
|
var package_default = {
|
|
1678
1679
|
name: "@batijs/cli",
|
|
1679
|
-
version: "0.0.
|
|
1680
|
+
version: "0.0.261",
|
|
1680
1681
|
type: "module",
|
|
1681
1682
|
scripts: {
|
|
1682
1683
|
"check-types": "tsc --noEmit",
|
|
@@ -1759,6 +1760,10 @@ Choose one of them, or simply remove selected Server`
|
|
|
1759
1760
|
[RulesMessage.ERROR_LUCIA_R_COMPAT_DATABASE]: error(
|
|
1760
1761
|
`${inverse(bold("Lucia"))} requires a ${inverse(bold("Database"))}, and is only compatible with ${inverse(bold("SQLite"))} or ${inverse(bold("Drizzle"))}`
|
|
1761
1762
|
),
|
|
1763
|
+
[RulesMessage.ERROR_AWS_R_COMPAT_SERVER]: error(
|
|
1764
|
+
`${inverse(bold("AWS"))} is only compatible with ${inverse(bold("Hono"))} or ${inverse(bold("HatTip"))}.
|
|
1765
|
+
Choose one of them, or simply remove selected Server`
|
|
1766
|
+
),
|
|
1762
1767
|
[RulesMessage.INFO_DRIZZLE_STACKBLITZ]: null
|
|
1763
1768
|
};
|
|
1764
1769
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.261",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"typescript": "^5.5.4",
|
|
21
21
|
"unplugin-purge-polyfills": "^0.0.5",
|
|
22
22
|
"vite": "^5.4.2",
|
|
23
|
-
"@batijs/
|
|
24
|
-
"@batijs/
|
|
23
|
+
"@batijs/compile": "0.0.261",
|
|
24
|
+
"@batijs/build": "0.0.261"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@batijs/
|
|
28
|
-
"@batijs/
|
|
27
|
+
"@batijs/core": "0.0.261",
|
|
28
|
+
"@batijs/features": "0.0.261"
|
|
29
29
|
},
|
|
30
30
|
"bin": "./dist/index.js",
|
|
31
31
|
"exports": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { db } from "./db";
|
|
2
|
-
import { todoTable } from "./schema/todos";
|
|
3
|
-
|
|
4
|
-
async function seed() {
|
|
5
|
-
db()
|
|
6
|
-
.insert(todoTable)
|
|
7
|
-
.values([{ text: "Buy milk" }, { text: "Buy strawberries" }])
|
|
8
|
-
.run();
|
|
9
|
-
|
|
10
|
-
console.log("Seed complete!");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
await seed();
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// files/$vite.config.ts.ts
|
|
2
|
-
import { addVitePlugin, loadAsMagicast } from "@batijs/core";
|
|
3
|
-
async function getViteConfig(props) {
|
|
4
|
-
const mod = await loadAsMagicast(props);
|
|
5
|
-
addVitePlugin(mod, {
|
|
6
|
-
from: "./trpc/vite-plugin",
|
|
7
|
-
constructor: "trpc"
|
|
8
|
-
});
|
|
9
|
-
return mod.generate().code;
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
getViteConfig as default
|
|
13
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { AnyRouter } from "@trpc/server";
|
|
2
|
-
import {
|
|
3
|
-
nodeHTTPRequestHandler,
|
|
4
|
-
type NodeHTTPHandlerOptions,
|
|
5
|
-
type NodeHTTPRequest,
|
|
6
|
-
type NodeHTTPResponse,
|
|
7
|
-
} from "@trpc/server/adapters/node-http";
|
|
8
|
-
import type { PluginOption } from "vite";
|
|
9
|
-
import { appRouter } from "./server.js";
|
|
10
|
-
|
|
11
|
-
type TrpcPluginOptions<
|
|
12
|
-
TRouter extends AnyRouter,
|
|
13
|
-
TRequest extends NodeHTTPRequest,
|
|
14
|
-
TResponse extends NodeHTTPResponse,
|
|
15
|
-
> = {
|
|
16
|
-
/**
|
|
17
|
-
* Path where the trpc router will be mounted.
|
|
18
|
-
* @default '/api/trpc'
|
|
19
|
-
*/
|
|
20
|
-
basePath: string;
|
|
21
|
-
} & NodeHTTPHandlerOptions<TRouter, TRequest, TResponse>;
|
|
22
|
-
|
|
23
|
-
export default function trpc<
|
|
24
|
-
TRouter extends AnyRouter,
|
|
25
|
-
TRequest extends NodeHTTPRequest,
|
|
26
|
-
TResponse extends NodeHTTPResponse,
|
|
27
|
-
>(options?: TrpcPluginOptions<TRouter, TRequest, TResponse>): PluginOption {
|
|
28
|
-
return {
|
|
29
|
-
name: "trpc",
|
|
30
|
-
configureServer(server) {
|
|
31
|
-
server.middlewares.use(options?.basePath || "/api/trpc", (req, res) => {
|
|
32
|
-
const url = new URL(req.url || "/", "http://localhost");
|
|
33
|
-
const path = url.pathname.replace(/^\//, "");
|
|
34
|
-
|
|
35
|
-
return nodeHTTPRequestHandler({
|
|
36
|
-
req: req as TRequest,
|
|
37
|
-
res: res as TResponse,
|
|
38
|
-
path,
|
|
39
|
-
router: options?.router || appRouter,
|
|
40
|
-
createContext: options?.createContext,
|
|
41
|
-
batching: options?.batching,
|
|
42
|
-
responseMeta: options?.responseMeta,
|
|
43
|
-
maxBodySize: options?.maxBodySize,
|
|
44
|
-
onError: options?.onError,
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AnyRouter } from "@trpc/server";
|
|
2
|
-
import { type NodeHTTPHandlerOptions, type NodeHTTPRequest, type NodeHTTPResponse } from "@trpc/server/adapters/node-http";
|
|
3
|
-
import type { PluginOption } from "vite";
|
|
4
|
-
type TrpcPluginOptions<TRouter extends AnyRouter, TRequest extends NodeHTTPRequest, TResponse extends NodeHTTPResponse> = {
|
|
5
|
-
/**
|
|
6
|
-
* Path where the trpc router will be mounted.
|
|
7
|
-
* @default '/api/trpc'
|
|
8
|
-
*/
|
|
9
|
-
basePath: string;
|
|
10
|
-
} & NodeHTTPHandlerOptions<TRouter, TRequest, TResponse>;
|
|
11
|
-
export default function trpc<TRouter extends AnyRouter, TRequest extends NodeHTTPRequest, TResponse extends NodeHTTPResponse>(options?: TrpcPluginOptions<TRouter, TRequest, TResponse>): PluginOption;
|
|
12
|
-
export {};
|