@batijs/cli 0.0.258 → 0.0.260

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.
Files changed (88) hide show
  1. package/dist/boilerplates/@batijs/authjs/files/$package.json.js +1 -1
  2. package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +2 -2
  3. package/dist/boilerplates/@batijs/authjs/types/server/authjs-handler.d.ts +2 -3
  4. package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +1 -1
  5. package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +10 -0
  6. package/dist/boilerplates/@batijs/d1/files/$README.md.js +0 -4
  7. package/dist/boilerplates/@batijs/d1/files/$package.json.js +96 -0
  8. package/dist/boilerplates/@batijs/d1/files/$wrangler.toml.js +1 -0
  9. package/dist/boilerplates/@batijs/d1/files/database/d1/helpers.ts +17 -0
  10. package/dist/boilerplates/@batijs/d1/files/vike.d.ts +8 -0
  11. package/dist/boilerplates/@batijs/d1/types/database/d1/helpers.d.ts +6 -0
  12. package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +10 -0
  13. package/dist/boilerplates/@batijs/d1-sqlite/files/database/d1/queries/lucia-auth.ts +28 -0
  14. package/dist/boilerplates/@batijs/d1-sqlite/files/database/d1/queries/todos.ts +10 -0
  15. package/dist/boilerplates/@batijs/d1-sqlite/files/database/migrations/lucia-auth.sql +20 -0
  16. package/dist/boilerplates/@batijs/d1-sqlite/files/database/migrations/todos.sql +4 -0
  17. package/dist/boilerplates/@batijs/d1-sqlite/types/database/d1/queries/lucia-auth.d.ts +5 -0
  18. package/dist/boilerplates/@batijs/d1-sqlite/types/database/d1/queries/todos.d.ts +6 -0
  19. package/dist/boilerplates/@batijs/drizzle/files/$.env.js +1 -0
  20. package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +0 -3
  21. package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +7 -14
  22. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/db.ts +10 -12
  23. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/lucia-auth.ts +38 -9
  24. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/todos.ts +16 -5
  25. package/dist/boilerplates/@batijs/drizzle/files/drizzle.config.ts +7 -4
  26. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/db.d.ts +2 -2
  27. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/lucia-auth.d.ts +19 -6
  28. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/todos.d.ts +9 -2
  29. package/dist/boilerplates/@batijs/eslint/files/$package.json.js +1 -1
  30. package/dist/boilerplates/@batijs/eslint/files/eslint.config.js +2 -1
  31. package/dist/boilerplates/@batijs/express/files/$package.json.js +2 -1
  32. package/dist/boilerplates/@batijs/express/files/express-entry.ts +13 -12
  33. package/dist/boilerplates/@batijs/fastify/files/$package.json.js +2 -1
  34. package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +17 -24
  35. package/dist/boilerplates/@batijs/firebase-auth/files/$package.json.js +2 -2
  36. package/dist/boilerplates/@batijs/firebase-auth/files/server/firebase-auth-middleware.ts +2 -2
  37. package/dist/boilerplates/@batijs/firebase-auth/types/server/firebase-auth-middleware.d.ts +2 -6
  38. package/dist/boilerplates/@batijs/h3/files/$package.json.js +1 -0
  39. package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +12 -2
  40. package/dist/boilerplates/@batijs/hattip/files/$package.json.js +3 -1
  41. package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +12 -12
  42. package/dist/boilerplates/@batijs/hono/files/$package.json.js +14 -3
  43. package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +12 -12
  44. package/dist/boilerplates/@batijs/lucia-auth/files/$package.json.js +4 -1
  45. package/dist/boilerplates/@batijs/lucia-auth/files/lib/lucia-auth.ts +75 -39
  46. package/dist/boilerplates/@batijs/lucia-auth/files/server/lucia-auth-handlers.ts +77 -33
  47. package/dist/boilerplates/@batijs/lucia-auth/types/lib/lucia-auth.d.ts +30 -10
  48. package/dist/boilerplates/@batijs/lucia-auth/types/server/lucia-auth-handlers.d.ts +13 -13
  49. package/dist/boilerplates/@batijs/react-lucia-auth/files/pages/login/+Page.tsx +2 -1
  50. package/dist/boilerplates/@batijs/shared/files/vite.config.ts +6 -0
  51. package/dist/boilerplates/@batijs/shared-db/files/server/db-middleware.ts +37 -0
  52. package/dist/boilerplates/@batijs/shared-db/types/server/db-middleware.d.ts +17 -0
  53. package/dist/boilerplates/@batijs/shared-no-db/files/$package.json.js +2 -1
  54. package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +5 -2
  55. package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +22 -4
  56. package/dist/boilerplates/@batijs/shared-server/files/server/vike-handler.ts +2 -2
  57. package/dist/boilerplates/@batijs/shared-server/types/server/create-todo-handler.d.ts +19 -1
  58. package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+data.ts +10 -4
  59. package/dist/boilerplates/@batijs/shared-todo/files/vike.d.ts +19 -0
  60. package/dist/boilerplates/@batijs/shared-todo/types/pages/todo/+data.d.ts +2 -1
  61. package/dist/boilerplates/@batijs/solid-lucia-auth/files/pages/login/+Page.tsx +2 -1
  62. package/dist/boilerplates/@batijs/sqlite/files/$.env.js +1 -0
  63. package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +10 -1
  64. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/queries/lucia-auth.ts +16 -15
  65. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/queries/todos.ts +5 -5
  66. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/queries/lucia-auth.d.ts +5 -5
  67. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/queries/todos.d.ts +3 -2
  68. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +5 -3
  69. package/dist/boilerplates/@batijs/telefunc/files/pages/todo/TodoList.telefunc.ts +10 -3
  70. package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +15 -2
  71. package/dist/boilerplates/@batijs/telefunc/files/vike.d.ts +20 -0
  72. package/dist/boilerplates/@batijs/trpc/files/$package.json.js +10 -7
  73. package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +22 -0
  74. package/dist/boilerplates/@batijs/trpc/files/trpc/server.ts +20 -4
  75. package/dist/boilerplates/@batijs/trpc/types/server/trpc-handler.d.ts +1 -0
  76. package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +36 -4
  77. package/dist/boilerplates/@batijs/trpc/types/trpc/server.d.ts +75 -8
  78. package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +4 -3
  79. package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +48 -27
  80. package/dist/boilerplates/@batijs/vue-lucia-auth/files/pages/login/+Page.vue +2 -1
  81. package/dist/boilerplates/boilerplates.json +50 -3
  82. package/dist/index.js +18 -1
  83. package/package.json +5 -5
  84. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/seed.ts +0 -13
  85. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/seed.d.ts +0 -1
  86. package/dist/boilerplates/@batijs/trpc/files/$vite.config.ts.js +0 -13
  87. package/dist/boilerplates/@batijs/trpc/files/trpc/vite-plugin.ts +0 -49
  88. package/dist/boilerplates/@batijs/trpc/types/trpc/vite-plugin.d.ts +0 -12
@@ -63,8 +63,11 @@
63
63
  "config": {
64
64
  "if": {
65
65
  "flag": {
66
+ "$in": [
67
+ "drizzle",
68
+ "sqlite"
69
+ ],
66
70
  "$all": [
67
- "sqlite",
68
71
  "cloudflare"
69
72
  ]
70
73
  }
@@ -75,6 +78,22 @@
75
78
  "files"
76
79
  ]
77
80
  },
81
+ {
82
+ "config": {
83
+ "if": {
84
+ "flag": {
85
+ "$all": [
86
+ "sqlite",
87
+ "cloudflare"
88
+ ]
89
+ }
90
+ }
91
+ },
92
+ "folder": "@batijs/d1-sqlite",
93
+ "subfolders": [
94
+ "files"
95
+ ]
96
+ },
78
97
  {
79
98
  "config": {
80
99
  "if": {
@@ -287,13 +306,32 @@
287
306
  "files"
288
307
  ]
289
308
  },
309
+ {
310
+ "config": {
311
+ "if": {
312
+ "flag": {
313
+ "$in": [
314
+ "drizzle",
315
+ "sqlite",
316
+ "edgedb",
317
+ "prisma"
318
+ ]
319
+ }
320
+ }
321
+ },
322
+ "folder": "@batijs/shared-db",
323
+ "subfolders": [
324
+ "files"
325
+ ]
326
+ },
290
327
  {
291
328
  "config": {
292
329
  "if": {
293
330
  "flag": {
294
331
  "$not": {
295
332
  "$in": [
296
- "drizzle"
333
+ "drizzle",
334
+ "sqlite"
297
335
  ]
298
336
  }
299
337
  }
@@ -400,7 +438,16 @@
400
438
  {
401
439
  "config": {
402
440
  "if": {
403
- "flag": "sqlite"
441
+ "flag": {
442
+ "$in": [
443
+ "sqlite"
444
+ ],
445
+ "$not": {
446
+ "$in": [
447
+ "cloudflare"
448
+ ]
449
+ }
450
+ }
404
451
  }
405
452
  },
406
453
  "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.258",
1680
+ version: "0.0.260",
1680
1681
  type: "module",
1681
1682
  scripts: {
1682
1683
  "check-types": "tsc --noEmit",
@@ -1923,6 +1924,21 @@ async function checkArguments(args) {
1923
1924
  }
1924
1925
  }
1925
1926
  }
1927
+ function checkFlagsExist(flags) {
1928
+ const inValidOptions = flags.reduce((acc, flag) => {
1929
+ if (!Object.prototype.hasOwnProperty.call(defaultDef, flag) && !features.some((f) => f.flag === flag)) {
1930
+ acc.push(flag);
1931
+ }
1932
+ return acc;
1933
+ }, []);
1934
+ const count = inValidOptions.length;
1935
+ if (count) {
1936
+ console.error(
1937
+ `${red("\u26A0")} Unknown option${count > 1 ? "s" : ""} ${bold(inValidOptions.join(", "))}. Use \`--help\` to list all available options.`
1938
+ );
1939
+ process.exit(5);
1940
+ }
1941
+ }
1926
1942
  function checkRules(flags) {
1927
1943
  const potentialRulesMessages = execRules(flags, rulesMessages);
1928
1944
  const infos = potentialRulesMessages.filter((m) => m?.type === "info");
@@ -2024,6 +2040,7 @@ async function run() {
2024
2040
  }
2025
2041
  return flag;
2026
2042
  }).flat(1);
2043
+ checkFlagsExist(flags);
2027
2044
  checkRules(flags);
2028
2045
  boilerplates.sort((b1, b2) => {
2029
2046
  if (b1.config.enforce === "pre") return -1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.258",
3
+ "version": "0.0.260",
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/build": "0.0.258",
24
- "@batijs/compile": "0.0.258"
23
+ "@batijs/build": "0.0.260",
24
+ "@batijs/compile": "0.0.260"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/features": "0.0.258",
28
- "@batijs/core": "0.0.258"
27
+ "@batijs/features": "0.0.260",
28
+ "@batijs/core": "0.0.260"
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 {};