@korajs/cli 0.4.0 → 0.6.0

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 (253) hide show
  1. package/dist/bin.cjs +1636 -601
  2. package/dist/bin.cjs.map +1 -1
  3. package/dist/bin.js +1086 -139
  4. package/dist/bin.js.map +1 -1
  5. package/dist/{chunk-MVP5PDT4.js → chunk-EEZNRI5W.js} +51 -6
  6. package/dist/chunk-EEZNRI5W.js.map +1 -0
  7. package/dist/{chunk-YGVO4POI.js → chunk-Q2FBCOQD.js} +27 -15
  8. package/dist/chunk-Q2FBCOQD.js.map +1 -0
  9. package/dist/{chunk-CMSX76KM.js → chunk-VLTPEATY.js} +172 -99
  10. package/dist/chunk-VLTPEATY.js.map +1 -0
  11. package/dist/create.cjs +130 -54
  12. package/dist/create.cjs.map +1 -1
  13. package/dist/create.js +2 -2
  14. package/dist/index.cjs +143 -62
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +8 -6
  17. package/dist/index.d.ts +8 -6
  18. package/dist/index.js +2 -2
  19. package/package.json +9 -3
  20. package/templates/react-basic/README.md.hbs +10 -1
  21. package/templates/react-basic/src/App.tsx +112 -126
  22. package/templates/react-basic/src/index.css +165 -159
  23. package/templates/react-basic/src/kora-worker.ts +0 -1
  24. package/templates/react-basic/src/main.tsx +12 -12
  25. package/templates/react-basic/src/modules/todos/todo.mutations.ts +25 -0
  26. package/templates/react-basic/src/modules/todos/todo.queries.ts +5 -0
  27. package/templates/react-basic/src/modules/todos/todo.schema.ts +10 -0
  28. package/templates/react-basic/src/modules/todos/useTodos.ts +31 -0
  29. package/templates/react-basic/src/schema.ts +6 -12
  30. package/templates/react-basic/src/vite-env.d.ts +17 -0
  31. package/templates/react-basic/{tsconfig.json → tsconfig.json.hbs} +1 -2
  32. package/templates/react-basic/vite.config.ts +57 -50
  33. package/templates/react-sync/.env.example +19 -0
  34. package/templates/react-sync/README.md.hbs +43 -1
  35. package/templates/react-sync/package.json.hbs +3 -0
  36. package/templates/react-sync/server.ts +90 -26
  37. package/templates/react-sync/src/App.tsx +132 -130
  38. package/templates/react-sync/src/auth.ts +25 -0
  39. package/templates/react-sync/src/index.css +212 -165
  40. package/templates/react-sync/src/kora-worker.ts +0 -1
  41. package/templates/react-sync/src/main.tsx +34 -18
  42. package/templates/react-sync/src/modules/todos/todo.mutations.ts +25 -0
  43. package/templates/react-sync/src/modules/todos/todo.queries.ts +5 -0
  44. package/templates/react-sync/src/modules/todos/todo.schema.ts +10 -0
  45. package/templates/react-sync/src/modules/todos/useTodos.ts +31 -0
  46. package/templates/react-sync/src/schema.ts +6 -12
  47. package/templates/react-sync/src/vite-env.d.ts +17 -0
  48. package/templates/react-sync/{tsconfig.json → tsconfig.json.hbs} +1 -2
  49. package/templates/react-sync/vite.config.ts +67 -60
  50. package/templates/react-tailwind/README.md.hbs +10 -1
  51. package/templates/react-tailwind/src/App.tsx +186 -197
  52. package/templates/react-tailwind/src/index.css +3 -3
  53. package/templates/react-tailwind/src/kora-worker.ts +0 -1
  54. package/templates/react-tailwind/src/main.tsx +19 -12
  55. package/templates/react-tailwind/src/modules/todos/todo.mutations.ts +25 -0
  56. package/templates/react-tailwind/src/modules/todos/todo.queries.ts +5 -0
  57. package/templates/react-tailwind/src/modules/todos/todo.schema.ts +10 -0
  58. package/templates/react-tailwind/src/modules/todos/useTodos.ts +31 -0
  59. package/templates/react-tailwind/src/schema.ts +6 -12
  60. package/templates/react-tailwind/src/vite-env.d.ts +17 -0
  61. package/templates/react-tailwind/{tsconfig.json → tsconfig.json.hbs} +1 -2
  62. package/templates/react-tailwind/vite.config.ts +57 -50
  63. package/templates/react-tailwind-sync/.env.example +19 -0
  64. package/templates/react-tailwind-sync/README.md.hbs +43 -1
  65. package/templates/react-tailwind-sync/package.json.hbs +3 -0
  66. package/templates/react-tailwind-sync/server.ts +90 -26
  67. package/templates/react-tailwind-sync/src/App.tsx +246 -222
  68. package/templates/react-tailwind-sync/src/auth.ts +25 -0
  69. package/templates/react-tailwind-sync/src/index.css +3 -3
  70. package/templates/react-tailwind-sync/src/kora-worker.ts +0 -1
  71. package/templates/react-tailwind-sync/src/main.tsx +48 -18
  72. package/templates/react-tailwind-sync/src/modules/todos/todo.mutations.ts +25 -0
  73. package/templates/react-tailwind-sync/src/modules/todos/todo.queries.ts +5 -0
  74. package/templates/react-tailwind-sync/src/modules/todos/todo.schema.ts +10 -0
  75. package/templates/react-tailwind-sync/src/modules/todos/useTodos.ts +31 -0
  76. package/templates/react-tailwind-sync/src/schema.ts +6 -12
  77. package/templates/react-tailwind-sync/src/vite-env.d.ts +17 -0
  78. package/templates/react-tailwind-sync/{tsconfig.json → tsconfig.json.hbs} +1 -2
  79. package/templates/react-tailwind-sync/vite.config.ts +67 -60
  80. package/templates/svelte-basic/.env.example +3 -0
  81. package/templates/svelte-basic/README.md.hbs +62 -0
  82. package/templates/svelte-basic/index.html.hbs +12 -0
  83. package/templates/svelte-basic/kora.config.ts +12 -0
  84. package/templates/svelte-basic/package.json.hbs +27 -0
  85. package/templates/svelte-basic/src/App.svelte +131 -0
  86. package/templates/svelte-basic/src/Root.svelte +14 -0
  87. package/templates/svelte-basic/src/index.css +287 -0
  88. package/templates/svelte-basic/src/kora-worker.ts +9 -0
  89. package/templates/svelte-basic/src/main.ts +16 -0
  90. package/templates/svelte-basic/src/modules/todos/todo.mutations.ts +25 -0
  91. package/templates/svelte-basic/src/modules/todos/todo.queries.ts +5 -0
  92. package/templates/svelte-basic/src/modules/todos/todo.schema.ts +10 -0
  93. package/templates/svelte-basic/src/modules/todos/useTodos.ts +25 -0
  94. package/templates/svelte-basic/src/schema.ts +9 -0
  95. package/templates/svelte-basic/src/vite-env.d.ts +12 -0
  96. package/templates/svelte-basic/svelte.config.js +5 -0
  97. package/templates/svelte-basic/tsconfig.json.hbs +14 -0
  98. package/templates/svelte-basic/vite.config.ts +52 -0
  99. package/templates/svelte-sync/.env.example +25 -0
  100. package/templates/svelte-sync/README.md.hbs +105 -0
  101. package/templates/svelte-sync/index.html.hbs +12 -0
  102. package/templates/svelte-sync/kora.config.ts +17 -0
  103. package/templates/svelte-sync/package.json.hbs +43 -0
  104. package/templates/svelte-sync/server.ts +90 -0
  105. package/templates/svelte-sync/src/App.svelte +154 -0
  106. package/templates/svelte-sync/src/Root.svelte +22 -0
  107. package/templates/svelte-sync/src/auth.ts +25 -0
  108. package/templates/svelte-sync/src/index.css +339 -0
  109. package/templates/svelte-sync/src/kora-worker.ts +9 -0
  110. package/templates/svelte-sync/src/main.ts +32 -0
  111. package/templates/svelte-sync/src/modules/todos/todo.mutations.ts +25 -0
  112. package/templates/svelte-sync/src/modules/todos/todo.queries.ts +5 -0
  113. package/templates/svelte-sync/src/modules/todos/todo.schema.ts +10 -0
  114. package/templates/svelte-sync/src/modules/todos/useTodos.ts +25 -0
  115. package/templates/svelte-sync/src/schema.ts +9 -0
  116. package/templates/svelte-sync/src/vite-env.d.ts +21 -0
  117. package/templates/svelte-sync/svelte.config.js +5 -0
  118. package/templates/svelte-sync/tsconfig.json.hbs +14 -0
  119. package/templates/svelte-sync/vite.config.ts +79 -0
  120. package/templates/svelte-tailwind/README.md.hbs +62 -0
  121. package/templates/svelte-tailwind/index.html.hbs +12 -0
  122. package/templates/svelte-tailwind/kora.config.ts +12 -0
  123. package/templates/svelte-tailwind/package.json.hbs +30 -0
  124. package/templates/svelte-tailwind/src/App.svelte +79 -0
  125. package/templates/svelte-tailwind/src/Root.svelte +14 -0
  126. package/templates/svelte-tailwind/src/index.css +7 -0
  127. package/templates/svelte-tailwind/src/kora-worker.ts +9 -0
  128. package/templates/svelte-tailwind/src/main.ts +16 -0
  129. package/templates/svelte-tailwind/src/modules/todos/todo.mutations.ts +25 -0
  130. package/templates/svelte-tailwind/src/modules/todos/todo.queries.ts +5 -0
  131. package/templates/svelte-tailwind/src/modules/todos/todo.schema.ts +10 -0
  132. package/templates/svelte-tailwind/src/modules/todos/useTodos.ts +25 -0
  133. package/templates/svelte-tailwind/src/schema.ts +9 -0
  134. package/templates/svelte-tailwind/src/vite-env.d.ts +12 -0
  135. package/templates/svelte-tailwind/svelte.config.js +5 -0
  136. package/templates/svelte-tailwind/tsconfig.json.hbs +14 -0
  137. package/templates/svelte-tailwind/vite.config.ts +53 -0
  138. package/templates/svelte-tailwind-sync/.env.example +25 -0
  139. package/templates/svelte-tailwind-sync/README.md.hbs +105 -0
  140. package/templates/svelte-tailwind-sync/index.html.hbs +12 -0
  141. package/templates/svelte-tailwind-sync/kora.config.ts +17 -0
  142. package/templates/svelte-tailwind-sync/package.json.hbs +46 -0
  143. package/templates/svelte-tailwind-sync/server.ts +90 -0
  144. package/templates/svelte-tailwind-sync/src/App.svelte +196 -0
  145. package/templates/svelte-tailwind-sync/src/Root.svelte +26 -0
  146. package/templates/svelte-tailwind-sync/src/auth.ts +25 -0
  147. package/templates/svelte-tailwind-sync/src/index.css +7 -0
  148. package/templates/svelte-tailwind-sync/src/kora-worker.ts +9 -0
  149. package/templates/svelte-tailwind-sync/src/main.ts +32 -0
  150. package/templates/svelte-tailwind-sync/src/modules/todos/todo.mutations.ts +25 -0
  151. package/templates/svelte-tailwind-sync/src/modules/todos/todo.queries.ts +5 -0
  152. package/templates/svelte-tailwind-sync/src/modules/todos/todo.schema.ts +10 -0
  153. package/templates/svelte-tailwind-sync/src/modules/todos/useTodos.ts +25 -0
  154. package/templates/svelte-tailwind-sync/src/schema.ts +9 -0
  155. package/templates/svelte-tailwind-sync/src/vite-env.d.ts +21 -0
  156. package/templates/svelte-tailwind-sync/svelte.config.js +5 -0
  157. package/templates/svelte-tailwind-sync/tsconfig.json.hbs +14 -0
  158. package/templates/svelte-tailwind-sync/vite.config.ts +80 -0
  159. package/templates/tauri-react/.env.example +20 -0
  160. package/templates/tauri-react/README.md.hbs +36 -1
  161. package/templates/tauri-react/dev.ts +11 -11
  162. package/templates/tauri-react/package.json.hbs +2 -0
  163. package/templates/tauri-react/server.ts +86 -12
  164. package/templates/tauri-react/src/App.tsx +769 -544
  165. package/templates/tauri-react/src/AppShell.tsx +125 -83
  166. package/templates/tauri-react/src/SetupScreen.tsx +257 -208
  167. package/templates/tauri-react/src/auth.ts +45 -0
  168. package/templates/tauri-react/src/main.tsx +3 -3
  169. package/templates/tauri-react/src/modules/todos/todo.mutations.ts +25 -0
  170. package/templates/tauri-react/src/modules/todos/todo.queries.ts +5 -0
  171. package/templates/tauri-react/src/modules/todos/todo.schema.ts +10 -0
  172. package/templates/tauri-react/src/modules/todos/useTodos.ts +31 -0
  173. package/templates/tauri-react/src/schema.ts +6 -12
  174. package/templates/tauri-react/src/sync-config.ts +47 -47
  175. package/templates/tauri-react/src/updater.ts +15 -15
  176. package/templates/tauri-react/src/vite-env.d.ts +17 -0
  177. package/templates/tauri-react/src-tauri/tauri.conf.json +1 -1
  178. package/templates/tauri-react/tsconfig.json.hbs +14 -0
  179. package/templates/tauri-react/vite.config.ts +9 -9
  180. package/templates/vue-basic/README.md.hbs +62 -0
  181. package/templates/vue-basic/index.html.hbs +12 -0
  182. package/templates/vue-basic/kora.config.ts +12 -0
  183. package/templates/vue-basic/package.json.hbs +26 -0
  184. package/templates/vue-basic/src/App.vue +117 -0
  185. package/templates/vue-basic/src/index.css +287 -0
  186. package/templates/vue-basic/src/kora-worker.ts +9 -0
  187. package/templates/vue-basic/src/main.ts +20 -0
  188. package/templates/vue-basic/src/modules/todos/todo.mutations.ts +25 -0
  189. package/templates/vue-basic/src/modules/todos/todo.queries.ts +5 -0
  190. package/templates/vue-basic/src/modules/todos/todo.schema.ts +10 -0
  191. package/templates/vue-basic/src/modules/todos/useTodos.ts +32 -0
  192. package/templates/vue-basic/src/schema.ts +9 -0
  193. package/templates/vue-basic/src/vite-env.d.ts +17 -0
  194. package/templates/vue-basic/tsconfig.json.hbs +15 -0
  195. package/templates/vue-basic/vite.config.ts +69 -0
  196. package/templates/vue-sync/.env.example +25 -0
  197. package/templates/vue-sync/README.md.hbs +105 -0
  198. package/templates/vue-sync/index.html.hbs +12 -0
  199. package/templates/vue-sync/kora.config.ts +17 -0
  200. package/templates/vue-sync/package.json.hbs +42 -0
  201. package/templates/vue-sync/server.ts +90 -0
  202. package/templates/vue-sync/src/App.vue +135 -0
  203. package/templates/vue-sync/src/auth.ts +25 -0
  204. package/templates/vue-sync/src/index.css +339 -0
  205. package/templates/vue-sync/src/kora-worker.ts +9 -0
  206. package/templates/vue-sync/src/main.ts +43 -0
  207. package/templates/vue-sync/src/modules/todos/todo.mutations.ts +25 -0
  208. package/templates/vue-sync/src/modules/todos/todo.queries.ts +5 -0
  209. package/templates/vue-sync/src/modules/todos/todo.schema.ts +10 -0
  210. package/templates/vue-sync/src/modules/todos/useTodos.ts +32 -0
  211. package/templates/vue-sync/src/schema.ts +9 -0
  212. package/templates/vue-sync/src/vite-env.d.ts +26 -0
  213. package/templates/vue-sync/tsconfig.json.hbs +15 -0
  214. package/templates/vue-sync/vite.config.ts +79 -0
  215. package/templates/vue-tailwind/README.md.hbs +62 -0
  216. package/templates/vue-tailwind/index.html.hbs +12 -0
  217. package/templates/vue-tailwind/kora.config.ts +12 -0
  218. package/templates/vue-tailwind/package.json.hbs +29 -0
  219. package/templates/vue-tailwind/src/App.vue +142 -0
  220. package/templates/vue-tailwind/src/index.css +7 -0
  221. package/templates/vue-tailwind/src/kora-worker.ts +9 -0
  222. package/templates/vue-tailwind/src/main.ts +31 -0
  223. package/templates/vue-tailwind/src/modules/todos/todo.mutations.ts +25 -0
  224. package/templates/vue-tailwind/src/modules/todos/todo.queries.ts +5 -0
  225. package/templates/vue-tailwind/src/modules/todos/todo.schema.ts +10 -0
  226. package/templates/vue-tailwind/src/modules/todos/useTodos.ts +32 -0
  227. package/templates/vue-tailwind/src/schema.ts +9 -0
  228. package/templates/vue-tailwind/src/vite-env.d.ts +17 -0
  229. package/templates/vue-tailwind/tsconfig.json.hbs +15 -0
  230. package/templates/vue-tailwind/vite.config.ts +70 -0
  231. package/templates/vue-tailwind-sync/.env.example +25 -0
  232. package/templates/vue-tailwind-sync/README.md.hbs +105 -0
  233. package/templates/vue-tailwind-sync/index.html.hbs +12 -0
  234. package/templates/vue-tailwind-sync/kora.config.ts +17 -0
  235. package/templates/vue-tailwind-sync/package.json.hbs +45 -0
  236. package/templates/vue-tailwind-sync/server.ts +90 -0
  237. package/templates/vue-tailwind-sync/src/App.vue +245 -0
  238. package/templates/vue-tailwind-sync/src/auth.ts +25 -0
  239. package/templates/vue-tailwind-sync/src/index.css +7 -0
  240. package/templates/vue-tailwind-sync/src/kora-worker.ts +9 -0
  241. package/templates/vue-tailwind-sync/src/main.ts +56 -0
  242. package/templates/vue-tailwind-sync/src/modules/todos/todo.mutations.ts +25 -0
  243. package/templates/vue-tailwind-sync/src/modules/todos/todo.queries.ts +5 -0
  244. package/templates/vue-tailwind-sync/src/modules/todos/todo.schema.ts +10 -0
  245. package/templates/vue-tailwind-sync/src/modules/todos/useTodos.ts +32 -0
  246. package/templates/vue-tailwind-sync/src/schema.ts +9 -0
  247. package/templates/vue-tailwind-sync/src/vite-env.d.ts +26 -0
  248. package/templates/vue-tailwind-sync/tsconfig.json.hbs +15 -0
  249. package/templates/vue-tailwind-sync/vite.config.ts +80 -0
  250. package/dist/chunk-CMSX76KM.js.map +0 -1
  251. package/dist/chunk-MVP5PDT4.js.map +0 -1
  252. package/dist/chunk-YGVO4POI.js.map +0 -1
  253. package/templates/tauri-react/tsconfig.json +0 -15
package/dist/create.cjs CHANGED
@@ -259,6 +259,14 @@ var TEMPLATES = [
259
259
  "react-tailwind",
260
260
  "react-sync",
261
261
  "react-basic",
262
+ "vue-sync",
263
+ "vue-basic",
264
+ "vue-tailwind-sync",
265
+ "vue-tailwind",
266
+ "svelte-sync",
267
+ "svelte-basic",
268
+ "svelte-tailwind-sync",
269
+ "svelte-tailwind",
262
270
  "tauri-react"
263
271
  ];
264
272
 
@@ -459,6 +467,19 @@ async function findNearestAncestorWithEntry(startDir, entryName) {
459
467
  function determineTemplateFromSelections(input) {
460
468
  if (input.platform === "desktop-tauri") return "tauri-react";
461
469
  const shouldSync = input.sync && input.db !== "none";
470
+ if (input.framework === "vue") {
471
+ if (input.tailwind && shouldSync) return "vue-tailwind-sync";
472
+ if (input.tailwind && !shouldSync) return "vue-tailwind";
473
+ return shouldSync ? "vue-sync" : "vue-basic";
474
+ }
475
+ if (input.framework === "svelte") {
476
+ if (input.tailwind && shouldSync) return "svelte-tailwind-sync";
477
+ if (input.tailwind && !shouldSync) return "svelte-tailwind";
478
+ return shouldSync ? "svelte-sync" : "svelte-basic";
479
+ }
480
+ if (input.framework === "solid") {
481
+ throw new Error("Solid templates are not available yet. Use react, vue, or svelte.");
482
+ }
462
483
  if (input.tailwind && shouldSync) return "react-tailwind-sync";
463
484
  if (input.tailwind && !shouldSync) return "react-tailwind";
464
485
  if (!input.tailwind && shouldSync) return "react-sync";
@@ -479,6 +500,9 @@ function isDatabaseValue(value) {
479
500
  function isDatabaseProviderValue(value) {
480
501
  return value === "none" || value === "local" || value === "supabase" || value === "neon" || value === "railway" || value === "vercel-postgres" || value === "custom";
481
502
  }
503
+ function isSupportedWebFramework(framework) {
504
+ return framework === "react" || framework === "vue" || framework === "svelte";
505
+ }
482
506
 
483
507
  // src/commands/create/preferences-flow.ts
484
508
  async function resolveCreatePreferencesFlow(params) {
@@ -518,10 +542,49 @@ async function resolveCreatePreferencesFlow(params) {
518
542
  if (isTauri) {
519
543
  effective.framework = "react";
520
544
  effective.tailwind = false;
521
- effective.sync = true;
522
- effective.db = "sqlite";
523
- effective.dbProvider = "none";
524
545
  effective.auth = "none";
546
+ if (flags.sync !== void 0) {
547
+ effective.sync = flags.sync;
548
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
549
+ effective.sync = await prompts.confirm("Enable multi-device sync?", true);
550
+ }
551
+ if (flags.db !== void 0) {
552
+ if (!isDatabaseValue(flags.db)) {
553
+ throw new Error(
554
+ `Invalid --db value "${flags.db}". Expected one of: none, sqlite, postgres.`
555
+ );
556
+ }
557
+ effective.db = flags.db;
558
+ } else if (!effective.sync) {
559
+ effective.db = "none";
560
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
561
+ effective.db = await prompts.select("Sync server database:", [
562
+ { label: "SQLite (zero-config; local, LAN, small teams)", value: "sqlite" },
563
+ { label: "PostgreSQL (production-scale)", value: "postgres" }
564
+ ]);
565
+ }
566
+ if (effective.db === "none") {
567
+ effective.sync = false;
568
+ }
569
+ if (effective.db !== "postgres") {
570
+ effective.dbProvider = "none";
571
+ } else if (flags.dbProvider !== void 0) {
572
+ if (!isDatabaseProviderValue(flags.dbProvider)) {
573
+ throw new Error(
574
+ `Invalid --db-provider value "${flags.dbProvider}". Expected one of: none, local, supabase, neon, railway, vercel-postgres, custom.`
575
+ );
576
+ }
577
+ effective.dbProvider = flags.dbProvider;
578
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
579
+ effective.dbProvider = await prompts.select("Database provider:", [
580
+ { label: "Local Postgres", value: "local" },
581
+ { label: "Supabase", value: "supabase" },
582
+ { label: "Neon", value: "neon" },
583
+ { label: "Railway", value: "railway" },
584
+ { label: "Vercel Postgres", value: "vercel-postgres" },
585
+ { label: "Custom connection string", value: "custom" }
586
+ ]);
587
+ }
525
588
  } else {
526
589
  if (flags.framework !== void 0) {
527
590
  if (!isFrameworkValue(flags.framework)) {
@@ -533,8 +596,8 @@ async function resolveCreatePreferencesFlow(params) {
533
596
  } else if (!flags.useDefaults && !usedStoredPreferences) {
534
597
  effective.framework = await prompts.select("UI framework:", [
535
598
  { label: "React", value: "react" },
536
- { label: "Vue (coming soon)", value: "vue", disabled: true },
537
- { label: "Svelte (coming soon)", value: "svelte", disabled: true },
599
+ { label: "Vue 3", value: "vue" },
600
+ { label: "Svelte 5", value: "svelte" },
538
601
  { label: "Solid (coming soon)", value: "solid", disabled: true }
539
602
  ]);
540
603
  }
@@ -599,6 +662,7 @@ async function resolveCreatePreferencesFlow(params) {
599
662
  }
600
663
  const template = determineTemplateFromSelections({
601
664
  platform: effective.platform,
665
+ framework: effective.framework,
602
666
  tailwind: effective.tailwind,
603
667
  sync: effective.sync,
604
668
  db: effective.db
@@ -681,67 +745,35 @@ async function applySyncProviderPreset(options) {
681
745
  }
682
746
  const providerName = getProviderDisplayName(options.dbProvider);
683
747
  const providerConnectionString = getProviderConnectionStringExample(options.dbProvider);
684
- const serverPath = (0, import_node_path3.join)(options.targetDir, "server.ts");
685
748
  const envPath = (0, import_node_path3.join)(options.targetDir, ".env.example");
686
749
  const readmePath = (0, import_node_path3.join)(options.targetDir, "README.md");
687
- const serverTemplate = [
688
- "import { createPostgresServerStore, createProductionServer } from '@korajs/server'",
689
- "",
690
- `// PostgreSQL provider preset: ${providerName}`,
691
- "// Ensure DATABASE_URL is set in your environment.",
692
- "",
693
- "async function start(): Promise<void> {",
694
- " const connectionString = process.env.DATABASE_URL || ''",
695
- " if (connectionString.length === 0) {",
696
- " throw new Error('DATABASE_URL is required for PostgreSQL sync server store.')",
697
- " }",
698
- "",
699
- " const store = await createPostgresServerStore({ connectionString })",
700
- " const server = createProductionServer({",
701
- " store,",
702
- " port: Number(process.env.PORT) || 3001,",
703
- " staticDir: './dist',",
704
- " syncPath: '/kora-sync',",
705
- " })",
706
- "",
707
- " const url = await server.start()",
708
- " console.log(`Kora app running at ${url}`)",
709
- "}",
710
- "",
711
- "void start()",
712
- ""
713
- ].join("\n");
714
- const envTemplate = [
715
- "# Kora Sync Server",
716
- "# WebSocket URL for the sync server (used by the client)",
717
- "VITE_SYNC_URL=ws://localhost:3001",
718
- "",
719
- "# Sync server port",
720
- "PORT=3001",
721
- "",
722
- `# PostgreSQL connection string (${providerName})`,
723
- `# Example: ${providerConnectionString}`,
724
- "DATABASE_URL=",
725
- ""
726
- ].join("\n");
727
750
  const existingReadme = await (0, import_promises3.readFile)(readmePath, "utf-8");
751
+ const existingEnv = await (0, import_promises3.readFile)(envPath, "utf-8");
728
752
  const trimmedReadme = existingReadme.trimEnd();
753
+ const trimmedEnv = existingEnv.trimEnd();
754
+ const envSuffix = [
755
+ "",
756
+ `# PostgreSQL provider preset: ${providerName}`,
757
+ `# Example: ${providerConnectionString}`
758
+ ].join("\n");
729
759
  const readmeSuffix = [
730
760
  "",
731
761
  "## PostgreSQL Provider Preset",
732
762
  "",
733
763
  `Selected DB provider: ${options.dbProvider}`,
734
764
  "",
735
- "This scaffold uses `createPostgresServerStore` in `server.ts` and reads `DATABASE_URL` from the environment. See `.env.example` for provider-specific examples.",
765
+ "This scaffold keeps one sync server entrypoint. When `DATABASE_URL` is set, `server.ts` uses PostgreSQL. When it is empty, the same server uses SQLite at `KORA_SERVER_DB`.",
766
+ "",
767
+ "The generated server uses `createPostgresServerStore` automatically when `DATABASE_URL` is present.",
736
768
  ""
737
769
  ].join("\n");
738
770
  const readmeTemplate = `${trimmedReadme}${readmeSuffix}`;
739
- await (0, import_promises3.writeFile)(serverPath, serverTemplate, "utf-8");
740
- await (0, import_promises3.writeFile)(envPath, envTemplate, "utf-8");
771
+ await (0, import_promises3.writeFile)(envPath, `${trimmedEnv}${envSuffix}
772
+ `, "utf-8");
741
773
  await (0, import_promises3.writeFile)(readmePath, readmeTemplate, "utf-8");
742
774
  }
743
775
  function isSyncTemplate(template) {
744
- return template === "react-sync" || template === "react-tailwind-sync" || template === "tauri-react";
776
+ return template === "react-sync" || template === "react-tailwind-sync" || template === "vue-sync" || template === "vue-tailwind-sync" || template === "svelte-sync" || template === "svelte-tailwind-sync" || template === "tauri-react";
745
777
  }
746
778
  function getProviderDisplayName(provider) {
747
779
  switch (provider) {
@@ -869,6 +901,48 @@ function createCompatibilityLayerPlan(templateName) {
869
901
  authLayer
870
902
  ]
871
903
  };
904
+ case "vue-sync":
905
+ return {
906
+ compatibilityTarget: templateName,
907
+ layers: [{ category: "base", name: "vue-sync", sourceTemplate: "vue-sync" }]
908
+ };
909
+ case "vue-basic":
910
+ return {
911
+ compatibilityTarget: templateName,
912
+ layers: [{ category: "base", name: "vue-basic", sourceTemplate: "vue-basic" }]
913
+ };
914
+ case "svelte-sync":
915
+ return {
916
+ compatibilityTarget: templateName,
917
+ layers: [{ category: "base", name: "svelte-sync", sourceTemplate: "svelte-sync" }]
918
+ };
919
+ case "svelte-basic":
920
+ return {
921
+ compatibilityTarget: templateName,
922
+ layers: [{ category: "base", name: "svelte-basic", sourceTemplate: "svelte-basic" }]
923
+ };
924
+ case "vue-tailwind-sync":
925
+ return {
926
+ compatibilityTarget: templateName,
927
+ layers: [{ category: "base", name: "vue-tailwind-sync", sourceTemplate: "vue-tailwind-sync" }]
928
+ };
929
+ case "vue-tailwind":
930
+ return {
931
+ compatibilityTarget: templateName,
932
+ layers: [{ category: "base", name: "vue-tailwind", sourceTemplate: "vue-tailwind" }]
933
+ };
934
+ case "svelte-tailwind-sync":
935
+ return {
936
+ compatibilityTarget: templateName,
937
+ layers: [
938
+ { category: "base", name: "svelte-tailwind-sync", sourceTemplate: "svelte-tailwind-sync" }
939
+ ]
940
+ };
941
+ case "svelte-tailwind":
942
+ return {
943
+ compatibilityTarget: templateName,
944
+ layers: [{ category: "base", name: "svelte-tailwind", sourceTemplate: "svelte-tailwind" }]
945
+ };
872
946
  }
873
947
  }
874
948
  async function composeTemplateLayers(plan, targetDir, context) {
@@ -931,7 +1005,7 @@ var createCommand = (0, import_citty.defineCommand)({
931
1005
  },
932
1006
  template: {
933
1007
  type: "string",
934
- description: "Project template (react-tailwind-sync, react-tailwind, react-sync, react-basic, tauri-react)"
1008
+ description: "Project template (react-tailwind-sync, react-sync, vue-sync, svelte-sync, tauri-react, ...)"
935
1009
  },
936
1010
  pm: {
937
1011
  type: "string",
@@ -1016,8 +1090,10 @@ var createCommand = (0, import_citty.defineCommand)({
1016
1090
  prompts,
1017
1091
  store: preferenceStore
1018
1092
  });
1019
- if (selection.framework !== "react") {
1020
- logger.error(`Framework "${selection.framework}" is not available yet. Use "react".`);
1093
+ if (!isSupportedWebFramework(selection.framework)) {
1094
+ logger.error(
1095
+ `Framework "${selection.framework}" is not available yet. Use react, vue, or svelte.`
1096
+ );
1021
1097
  if (!useDefaults) {
1022
1098
  prompts.outro("Project creation aborted.");
1023
1099
  }
@@ -1162,7 +1238,7 @@ function isValidPackageManager(value) {
1162
1238
  return PACKAGE_MANAGERS.includes(value);
1163
1239
  }
1164
1240
  function isSyncTemplate2(template) {
1165
- return template === "react-sync" || template === "react-tailwind-sync" || template === "tauri-react";
1241
+ return template === "react-sync" || template === "react-tailwind-sync" || template === "vue-sync" || template === "vue-tailwind-sync" || template === "svelte-sync" || template === "svelte-tailwind-sync" || template === "tauri-react";
1166
1242
  }
1167
1243
  function formatDbProviderForLog(dbProvider) {
1168
1244
  switch (dbProvider) {