@batijs/cli 0.0.254 → 0.0.257

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 (78) hide show
  1. package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +2 -1
  2. package/dist/boilerplates/@batijs/d1/files/$README.md.js +31 -0
  3. package/dist/boilerplates/@batijs/d1/files/$tsconfig.json.js +10 -0
  4. package/dist/boilerplates/@batijs/d1/files/$wrangler.toml.js +21 -0
  5. package/dist/boilerplates/@batijs/d1/files/vike.d.ts +8 -0
  6. package/dist/boilerplates/@batijs/drizzle/files/$.env.js +9 -0
  7. package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +4 -4
  8. package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +33 -14
  9. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/db.ts +16 -0
  10. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/lucia-auth.ts +27 -0
  11. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/todos.ts +11 -0
  12. package/dist/boilerplates/@batijs/drizzle/files/database/{schema → drizzle/schema}/todos.ts +1 -0
  13. package/dist/boilerplates/@batijs/drizzle/files/database/{seed.ts → drizzle/seed.ts} +3 -3
  14. package/dist/boilerplates/@batijs/drizzle/files/drizzle.config.ts +7 -3
  15. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/db.d.ts +2 -0
  16. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/lucia-auth.d.ts +12 -0
  17. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/todos.d.ts +43 -0
  18. package/dist/boilerplates/@batijs/express/files/express-entry.ts +1 -1
  19. package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +2 -2
  20. package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +1 -1
  21. package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +1 -1
  22. package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +1 -1
  23. package/dist/boilerplates/@batijs/lucia-auth/files/$package.json.js +1 -18
  24. package/dist/boilerplates/@batijs/lucia-auth/files/lib/lucia-auth.ts +5 -5
  25. package/dist/boilerplates/@batijs/lucia-auth/files/server/lucia-auth-handlers.ts +39 -26
  26. package/dist/boilerplates/@batijs/lucia-auth/types/server/lucia-auth-handlers.d.ts +7 -0
  27. package/dist/boilerplates/@batijs/mantine/files/$README.md.js +23 -0
  28. package/dist/boilerplates/@batijs/mantine/files/$package.json.js +122 -0
  29. package/dist/boilerplates/@batijs/mantine/files/components/Link.tsx +10 -0
  30. package/dist/boilerplates/@batijs/mantine/files/layouts/LayoutDefault.tsx +37 -0
  31. package/dist/boilerplates/@batijs/mantine/files/layouts/style.css +0 -0
  32. package/dist/boilerplates/@batijs/mantine/files/layouts/theme.ts +9 -0
  33. package/dist/boilerplates/@batijs/mantine/files/postcss.config.cjs +14 -0
  34. package/dist/boilerplates/@batijs/mantine/types/components/Link.d.ts +4 -0
  35. package/dist/boilerplates/@batijs/mantine/types/layouts/LayoutDefault.d.ts +5 -0
  36. package/dist/boilerplates/@batijs/mantine/types/layouts/theme.d.ts +3 -0
  37. package/dist/boilerplates/@batijs/mantine/types/postcss.config.d.cts +12 -0
  38. package/dist/boilerplates/@batijs/react/files/$package.json.js +1 -0
  39. package/dist/boilerplates/@batijs/react/files/layouts/HeadDefault.tsx +5 -0
  40. package/dist/boilerplates/@batijs/react/files/pages/todo/TodoList.tsx +1 -7
  41. package/dist/boilerplates/@batijs/shared/files/vite.config.ts +1 -1
  42. package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +1 -0
  43. package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +6 -3
  44. package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+data.ts +7 -3
  45. package/dist/boilerplates/@batijs/solid/files/pages/todo/TodoList.tsx +1 -7
  46. package/dist/boilerplates/@batijs/sqlite/files/$.env.js +9 -0
  47. package/dist/boilerplates/@batijs/sqlite/files/$README.md.js +18 -0
  48. package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +120 -0
  49. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/db.ts +15 -0
  50. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/queries/lucia-auth.ts +25 -0
  51. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/queries/todos.ts +9 -0
  52. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/schema/all.ts +3 -0
  53. package/dist/boilerplates/@batijs/{lucia-auth/files/database/sqliteDb.ts → sqlite/files/database/sqlite/schema/lucia-auth.ts} +6 -5
  54. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/schema/todos.ts +14 -0
  55. package/dist/boilerplates/@batijs/{lucia-auth/types/database/sqliteDb.d.ts → sqlite/types/database/sqlite/db.d.ts} +1 -1
  56. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/queries/lucia-auth.d.ts +5 -0
  57. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/queries/todos.d.ts +5 -0
  58. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/schema/all.d.ts +2 -0
  59. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/schema/lucia-auth.d.ts +1 -0
  60. package/dist/boilerplates/@batijs/sqlite/types/database/sqlite/schema/todos.d.ts +1 -0
  61. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -0
  62. package/dist/boilerplates/@batijs/telefunc/files/pages/todo/TodoList.telefunc.ts +5 -3
  63. package/dist/boilerplates/@batijs/trpc/files/$package.json.js +1 -0
  64. package/dist/boilerplates/@batijs/trpc/files/trpc/server.ts +5 -3
  65. package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +1 -0
  66. package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +5 -3
  67. package/dist/boilerplates/@batijs/vue/files/pages/todo/TodoList.vue +1 -1
  68. package/dist/boilerplates/boilerplates.json +44 -0
  69. package/dist/index.js +9 -3
  70. package/package.json +5 -5
  71. package/dist/boilerplates/@batijs/drizzle/files/database/drizzleDb.ts +0 -5
  72. package/dist/boilerplates/@batijs/drizzle/types/database/drizzleDb.d.ts +0 -1
  73. package/dist/boilerplates/@batijs/lucia-auth/files/database/auth-actions.ts +0 -54
  74. package/dist/boilerplates/@batijs/lucia-auth/types/database/auth-actions.d.ts +0 -9
  75. /package/dist/boilerplates/@batijs/{lucia-auth/files/database/schema/auth.ts → drizzle/files/database/drizzle/schema/lucia-auth.ts} +0 -0
  76. /package/dist/boilerplates/@batijs/{lucia-auth/types/database/schema/auth.d.ts → drizzle/types/database/drizzle/schema/lucia-auth.d.ts} +0 -0
  77. /package/dist/boilerplates/@batijs/drizzle/types/database/{schema → drizzle/schema}/todos.d.ts +0 -0
  78. /package/dist/boilerplates/@batijs/drizzle/types/database/{seed.d.ts → drizzle/seed.d.ts} +0 -0
@@ -43,6 +43,7 @@ var require_package = __commonJS({
43
43
  devDependencies: {
44
44
  "@batijs/compile": "workspace:*",
45
45
  "@batijs/drizzle": "workspace:*",
46
+ "@batijs/sqlite": "workspace:*",
46
47
  "@batijs/shared-no-db": "workspace:*",
47
48
  "@batijs/shared-todo": "workspace:*",
48
49
  "@types/node": "^18.19.14",
@@ -1,9 +1,11 @@
1
- import { drizzleDb } from "@batijs/drizzle/database/drizzleDb";
2
- import { todoTable } from "@batijs/drizzle/database/schema/todos";
1
+ import * as drizzleQueries from "@batijs/drizzle/database/drizzle/queries/todos";
2
+ import * as sqliteQueries from "@batijs/sqlite/database/sqlite/queries/todos";
3
3
 
4
4
  export async function onNewTodo({ text }: { text: string }) {
5
5
  if (BATI.has("drizzle")) {
6
- await drizzleDb.insert(todoTable).values({ text });
6
+ await drizzleQueries.insertTodo(text);
7
+ } else if (BATI.has("sqlite")) {
8
+ sqliteQueries.insertTodo(text);
7
9
  } else {
8
10
  // This is where you'd persist the data
9
11
  console.log("Received new todo", { text });
@@ -43,6 +43,7 @@ var require_package = __commonJS({
43
43
  devDependencies: {
44
44
  "@batijs/compile": "workspace:*",
45
45
  "@batijs/drizzle": "workspace:*",
46
+ "@batijs/sqlite": "workspace:*",
46
47
  "@batijs/shared-no-db": "workspace:*",
47
48
  "@batijs/shared-todo": "workspace:*",
48
49
  "@trpc/client": "^10.45.2",
@@ -1,6 +1,6 @@
1
- import { drizzleDb } from "@batijs/drizzle/database/drizzleDb";
2
- import { todoTable } from "@batijs/drizzle/database/schema/todos";
3
1
  import { initTRPC } from "@trpc/server";
2
+ import * as drizzleQueries from "@batijs/drizzle/database/drizzle/queries/todos";
3
+ import * as sqliteQueries from "@batijs/sqlite/database/sqlite/queries/todos";
4
4
 
5
5
  /**
6
6
  * Initialization of tRPC backend
@@ -28,7 +28,9 @@ export const appRouter = router({
28
28
  })
29
29
  .mutation(async (opts) => {
30
30
  if (BATI.has("drizzle")) {
31
- await drizzleDb.insert(todoTable).values({ text: opts.input });
31
+ await drizzleQueries.insertTodo(opts.input);
32
+ } else if (BATI.has("sqlite")) {
33
+ sqliteQueries.insertTodo(opts.input);
32
34
  } else {
33
35
  // This is where you'd persist the data
34
36
  console.log("Received new todo", { text: opts.input });
@@ -43,6 +43,7 @@ var require_package = __commonJS({
43
43
  devDependencies: {
44
44
  "@batijs/compile": "workspace:*",
45
45
  "@batijs/drizzle": "workspace:*",
46
+ "@batijs/sqlite": "workspace:*",
46
47
  "@batijs/shared-no-db": "workspace:*",
47
48
  "@ts-rest/core": "^3.51.0",
48
49
  "@ts-rest/serverless": "^3.51.0",
@@ -1,8 +1,8 @@
1
- import { drizzleDb } from "@batijs/drizzle/database/drizzleDb";
2
- import { todoTable } from "@batijs/drizzle/database/schema/todos";
3
1
  import { fetchRequestHandler, tsr } from "@ts-rest/serverless/fetch";
4
2
  import { contract } from "../ts-rest/contract";
5
3
  import { Get, UniversalHandler } from "@universal-middleware/core";
4
+ import * as drizzleQueries from "@batijs/drizzle/database/drizzle/queries/todos";
5
+ import * as sqliteQueries from "@batijs/sqlite/database/sqlite/queries/todos";
6
6
 
7
7
  /**
8
8
  * ts-rest route
@@ -20,7 +20,9 @@ const router = tsr.router(contract, {
20
20
  },
21
21
  createTodo: async ({ body }) => {
22
22
  if (BATI.has("drizzle")) {
23
- await drizzleDb.insert(todoTable).values({ text: body.text });
23
+ await drizzleQueries.insertTodo(body.text);
24
+ } else if (BATI.has("sqlite")) {
25
+ sqliteQueries.insertTodo(body.text);
24
26
  } else {
25
27
  // This is where you'd persist the data
26
28
  console.log("Received new todo", { text: body.text });
@@ -25,7 +25,7 @@ const newTodo = ref("");
25
25
  const submitNewTodo = async () => {
26
26
  // Optimistic UI update
27
27
  todoItems.value.push({ text: newTodo.value });
28
- if (BATI.has("express") || BATI.has("fastify") || BATI.has("h3") || BATI.has("hattip") || BATI.has("hono")) {
28
+ if (BATI.hasServer) {
29
29
  try {
30
30
  if (BATI.has("telefunc")) {
31
31
  await onNewTodo({ text: newTodo.value });
@@ -59,6 +59,22 @@
59
59
  "files"
60
60
  ]
61
61
  },
62
+ {
63
+ "config": {
64
+ "if": {
65
+ "flag": {
66
+ "$all": [
67
+ "sqlite",
68
+ "cloudflare"
69
+ ]
70
+ }
71
+ }
72
+ },
73
+ "folder": "@batijs/d1",
74
+ "subfolders": [
75
+ "files"
76
+ ]
77
+ },
62
78
  {
63
79
  "config": {
64
80
  "if": {
@@ -180,6 +196,23 @@
180
196
  "files"
181
197
  ]
182
198
  },
199
+ {
200
+ "config": {
201
+ "enforce": "post",
202
+ "if": {
203
+ "flag": {
204
+ "$all": [
205
+ "mantine",
206
+ "react"
207
+ ]
208
+ }
209
+ }
210
+ },
211
+ "folder": "@batijs/mantine",
212
+ "subfolders": [
213
+ "files"
214
+ ]
215
+ },
183
216
  {
184
217
  "config": {
185
218
  "if": {
@@ -364,6 +397,17 @@
364
397
  "files"
365
398
  ]
366
399
  },
400
+ {
401
+ "config": {
402
+ "if": {
403
+ "flag": "sqlite"
404
+ }
405
+ },
406
+ "folder": "@batijs/sqlite",
407
+ "subfolders": [
408
+ "files"
409
+ ]
410
+ },
367
411
  {
368
412
  "config": {
369
413
  "if": {
package/dist/index.js CHANGED
@@ -324,7 +324,7 @@ Please report this issue to https://github.com/vikejs/bati`
324
324
 
325
325
  // index.ts
326
326
  import { packageManager, which, withIcon } from "@batijs/core";
327
- import { cliFlags, features } from "@batijs/features";
327
+ import { BatiSet, cliFlags, features } from "@batijs/features";
328
328
  import { execRules } from "@batijs/features/rules";
329
329
 
330
330
  // ../../node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
@@ -1676,7 +1676,7 @@ var createDefaultQueryTester = function(query, options) {
1676
1676
  // package.json
1677
1677
  var package_default = {
1678
1678
  name: "@batijs/cli",
1679
- version: "0.0.254",
1679
+ version: "0.0.257",
1680
1680
  type: "module",
1681
1681
  scripts: {
1682
1682
  "check-types": "tsc --noEmit",
@@ -1742,6 +1742,9 @@ var rulesMessages = {
1742
1742
  [RulesMessage.ERROR_COMPILED_R_REACT]: error(
1743
1743
  `${inverse(bold("React"))} is required when using ${inverse(bold("Compiled"))}`
1744
1744
  ),
1745
+ [RulesMessage.ERROR_MANTINE_R_REACT]: error(
1746
+ `${inverse(bold("React"))} is required when using ${inverse(bold("Mantine"))}`
1747
+ ),
1745
1748
  [RulesMessage.INFO_HATTIP]: info(`${inverse(bold("HatTip"))} is an experimental project`),
1746
1749
  [RulesMessage.ERROR_DRIZZLE_R_SERVER]: error(
1747
1750
  `A ${inverse(bold("Server"))} is required when using ${inverse(bold("Drizzle"))}`
@@ -1753,6 +1756,9 @@ var rulesMessages = {
1753
1756
  `${inverse(bold("Cloudflare"))} is only compatible with ${inverse(bold("Hono"))} or ${inverse(bold("HatTip"))}.
1754
1757
  Choose one of them, or simply remove selected Server`
1755
1758
  ),
1759
+ [RulesMessage.ERROR_LUCIA_R_COMPAT_DATABASE]: error(
1760
+ `${inverse(bold("Lucia"))} requires a ${inverse(bold("Database"))}, and is only compatible with ${inverse(bold("SQLite"))} or ${inverse(bold("Drizzle"))}`
1761
+ ),
1756
1762
  [RulesMessage.INFO_DRIZZLE_STACKBLITZ]: null
1757
1763
  };
1758
1764
 
@@ -2038,7 +2044,7 @@ async function run() {
2038
2044
  }
2039
2045
  const hooksMap = await retrieveHooks(hooks);
2040
2046
  const meta = {
2041
- BATI: new Set(flags),
2047
+ BATI: new BatiSet(flags, features),
2042
2048
  BATI_TEST: Boolean(process.env.BATI_TEST)
2043
2049
  };
2044
2050
  await main(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.254",
3
+ "version": "0.0.257",
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/compile": "0.0.254",
24
- "@batijs/build": "0.0.254"
23
+ "@batijs/build": "0.0.257",
24
+ "@batijs/compile": "0.0.257"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/core": "0.0.254",
28
- "@batijs/features": "0.0.254"
27
+ "@batijs/core": "0.0.257",
28
+ "@batijs/features": "0.0.257"
29
29
  },
30
30
  "bin": "./dist/index.js",
31
31
  "exports": {
@@ -1,5 +0,0 @@
1
- import Database from "better-sqlite3";
2
- import { drizzle } from "drizzle-orm/better-sqlite3";
3
-
4
- const sqlite = new Database("sqlite.db");
5
- export const drizzleDb = drizzle(sqlite);
@@ -1 +0,0 @@
1
- export declare const drizzleDb: import("drizzle-orm/better-sqlite3").BetterSQLite3Database<Record<string, never>>;
@@ -1,54 +0,0 @@
1
- import { drizzleDb } from "@batijs/drizzle/database/drizzleDb";
2
- import { sqliteDb } from "./sqliteDb";
3
- import { userTable, oauthAccountTable } from "./schema/auth";
4
- import { eq, and } from "drizzle-orm";
5
-
6
- export function getExistingUser(username: string) {
7
- if (BATI.has("drizzle")) {
8
- return drizzleDb.select().from(userTable).where(eq(userTable.username, username)).get();
9
- } else {
10
- return sqliteDb.prepare("SELECT * FROM users WHERE username = ?").get(username);
11
- }
12
- }
13
-
14
- export function getExistingAccount(providerId: string, providerUserId: number) {
15
- if (BATI.has("drizzle")) {
16
- return drizzleDb
17
- .select()
18
- .from(oauthAccountTable)
19
- .where(and(eq(oauthAccountTable.providerId, providerId), eq(oauthAccountTable.providerUserId, providerUserId)))
20
- .get();
21
- } else {
22
- return sqliteDb
23
- .prepare("SELECT * FROM oauth_accounts WHERE provider_id = ? AND provider_user_id = ?")
24
- .get(providerId, providerUserId);
25
- }
26
- }
27
-
28
- export function validateInput(username: string | null, password: string | null) {
29
- const error: {
30
- username: string | null;
31
- password: string | null;
32
- } = {
33
- username: null,
34
- password: null,
35
- };
36
-
37
- if (!username || username.length < 3 || username.length > 31 || !/^[a-z0-9_-]+$/.test(username)) {
38
- error.username = "Invalid username";
39
- }
40
- if (!password || password.length < 6 || password.length > 255) {
41
- error.password = "Invalid password";
42
- }
43
-
44
- if (error.username || error.password) {
45
- return {
46
- error,
47
- success: false,
48
- };
49
- }
50
- return {
51
- error,
52
- success: true,
53
- };
54
- }
@@ -1,9 +0,0 @@
1
- export declare function getExistingUser(username: string): unknown;
2
- export declare function getExistingAccount(providerId: string, providerUserId: number): unknown;
3
- export declare function validateInput(username: string | null, password: string | null): {
4
- error: {
5
- username: string | null;
6
- password: string | null;
7
- };
8
- success: boolean;
9
- };