@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.
- package/dist/bin.cjs +1636 -601
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1086 -139
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-MVP5PDT4.js → chunk-EEZNRI5W.js} +51 -6
- package/dist/chunk-EEZNRI5W.js.map +1 -0
- package/dist/{chunk-YGVO4POI.js → chunk-Q2FBCOQD.js} +27 -15
- package/dist/chunk-Q2FBCOQD.js.map +1 -0
- package/dist/{chunk-CMSX76KM.js → chunk-VLTPEATY.js} +172 -99
- package/dist/chunk-VLTPEATY.js.map +1 -0
- package/dist/create.cjs +130 -54
- package/dist/create.cjs.map +1 -1
- package/dist/create.js +2 -2
- package/dist/index.cjs +143 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +2 -2
- package/package.json +9 -3
- package/templates/react-basic/README.md.hbs +10 -1
- package/templates/react-basic/src/App.tsx +112 -126
- package/templates/react-basic/src/index.css +165 -159
- package/templates/react-basic/src/kora-worker.ts +0 -1
- package/templates/react-basic/src/main.tsx +12 -12
- package/templates/react-basic/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/react-basic/src/modules/todos/todo.queries.ts +5 -0
- package/templates/react-basic/src/modules/todos/todo.schema.ts +10 -0
- package/templates/react-basic/src/modules/todos/useTodos.ts +31 -0
- package/templates/react-basic/src/schema.ts +6 -12
- package/templates/react-basic/src/vite-env.d.ts +17 -0
- package/templates/react-basic/{tsconfig.json → tsconfig.json.hbs} +1 -2
- package/templates/react-basic/vite.config.ts +57 -50
- package/templates/react-sync/.env.example +19 -0
- package/templates/react-sync/README.md.hbs +43 -1
- package/templates/react-sync/package.json.hbs +3 -0
- package/templates/react-sync/server.ts +90 -26
- package/templates/react-sync/src/App.tsx +132 -130
- package/templates/react-sync/src/auth.ts +25 -0
- package/templates/react-sync/src/index.css +212 -165
- package/templates/react-sync/src/kora-worker.ts +0 -1
- package/templates/react-sync/src/main.tsx +34 -18
- package/templates/react-sync/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/react-sync/src/modules/todos/todo.queries.ts +5 -0
- package/templates/react-sync/src/modules/todos/todo.schema.ts +10 -0
- package/templates/react-sync/src/modules/todos/useTodos.ts +31 -0
- package/templates/react-sync/src/schema.ts +6 -12
- package/templates/react-sync/src/vite-env.d.ts +17 -0
- package/templates/react-sync/{tsconfig.json → tsconfig.json.hbs} +1 -2
- package/templates/react-sync/vite.config.ts +67 -60
- package/templates/react-tailwind/README.md.hbs +10 -1
- package/templates/react-tailwind/src/App.tsx +186 -197
- package/templates/react-tailwind/src/index.css +3 -3
- package/templates/react-tailwind/src/kora-worker.ts +0 -1
- package/templates/react-tailwind/src/main.tsx +19 -12
- package/templates/react-tailwind/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/react-tailwind/src/modules/todos/todo.queries.ts +5 -0
- package/templates/react-tailwind/src/modules/todos/todo.schema.ts +10 -0
- package/templates/react-tailwind/src/modules/todos/useTodos.ts +31 -0
- package/templates/react-tailwind/src/schema.ts +6 -12
- package/templates/react-tailwind/src/vite-env.d.ts +17 -0
- package/templates/react-tailwind/{tsconfig.json → tsconfig.json.hbs} +1 -2
- package/templates/react-tailwind/vite.config.ts +57 -50
- package/templates/react-tailwind-sync/.env.example +19 -0
- package/templates/react-tailwind-sync/README.md.hbs +43 -1
- package/templates/react-tailwind-sync/package.json.hbs +3 -0
- package/templates/react-tailwind-sync/server.ts +90 -26
- package/templates/react-tailwind-sync/src/App.tsx +246 -222
- package/templates/react-tailwind-sync/src/auth.ts +25 -0
- package/templates/react-tailwind-sync/src/index.css +3 -3
- package/templates/react-tailwind-sync/src/kora-worker.ts +0 -1
- package/templates/react-tailwind-sync/src/main.tsx +48 -18
- package/templates/react-tailwind-sync/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/react-tailwind-sync/src/modules/todos/todo.queries.ts +5 -0
- package/templates/react-tailwind-sync/src/modules/todos/todo.schema.ts +10 -0
- package/templates/react-tailwind-sync/src/modules/todos/useTodos.ts +31 -0
- package/templates/react-tailwind-sync/src/schema.ts +6 -12
- package/templates/react-tailwind-sync/src/vite-env.d.ts +17 -0
- package/templates/react-tailwind-sync/{tsconfig.json → tsconfig.json.hbs} +1 -2
- package/templates/react-tailwind-sync/vite.config.ts +67 -60
- package/templates/svelte-basic/.env.example +3 -0
- package/templates/svelte-basic/README.md.hbs +62 -0
- package/templates/svelte-basic/index.html.hbs +12 -0
- package/templates/svelte-basic/kora.config.ts +12 -0
- package/templates/svelte-basic/package.json.hbs +27 -0
- package/templates/svelte-basic/src/App.svelte +131 -0
- package/templates/svelte-basic/src/Root.svelte +14 -0
- package/templates/svelte-basic/src/index.css +287 -0
- package/templates/svelte-basic/src/kora-worker.ts +9 -0
- package/templates/svelte-basic/src/main.ts +16 -0
- package/templates/svelte-basic/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/svelte-basic/src/modules/todos/todo.queries.ts +5 -0
- package/templates/svelte-basic/src/modules/todos/todo.schema.ts +10 -0
- package/templates/svelte-basic/src/modules/todos/useTodos.ts +25 -0
- package/templates/svelte-basic/src/schema.ts +9 -0
- package/templates/svelte-basic/src/vite-env.d.ts +12 -0
- package/templates/svelte-basic/svelte.config.js +5 -0
- package/templates/svelte-basic/tsconfig.json.hbs +14 -0
- package/templates/svelte-basic/vite.config.ts +52 -0
- package/templates/svelte-sync/.env.example +25 -0
- package/templates/svelte-sync/README.md.hbs +105 -0
- package/templates/svelte-sync/index.html.hbs +12 -0
- package/templates/svelte-sync/kora.config.ts +17 -0
- package/templates/svelte-sync/package.json.hbs +43 -0
- package/templates/svelte-sync/server.ts +90 -0
- package/templates/svelte-sync/src/App.svelte +154 -0
- package/templates/svelte-sync/src/Root.svelte +22 -0
- package/templates/svelte-sync/src/auth.ts +25 -0
- package/templates/svelte-sync/src/index.css +339 -0
- package/templates/svelte-sync/src/kora-worker.ts +9 -0
- package/templates/svelte-sync/src/main.ts +32 -0
- package/templates/svelte-sync/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/svelte-sync/src/modules/todos/todo.queries.ts +5 -0
- package/templates/svelte-sync/src/modules/todos/todo.schema.ts +10 -0
- package/templates/svelte-sync/src/modules/todos/useTodos.ts +25 -0
- package/templates/svelte-sync/src/schema.ts +9 -0
- package/templates/svelte-sync/src/vite-env.d.ts +21 -0
- package/templates/svelte-sync/svelte.config.js +5 -0
- package/templates/svelte-sync/tsconfig.json.hbs +14 -0
- package/templates/svelte-sync/vite.config.ts +79 -0
- package/templates/svelte-tailwind/README.md.hbs +62 -0
- package/templates/svelte-tailwind/index.html.hbs +12 -0
- package/templates/svelte-tailwind/kora.config.ts +12 -0
- package/templates/svelte-tailwind/package.json.hbs +30 -0
- package/templates/svelte-tailwind/src/App.svelte +79 -0
- package/templates/svelte-tailwind/src/Root.svelte +14 -0
- package/templates/svelte-tailwind/src/index.css +7 -0
- package/templates/svelte-tailwind/src/kora-worker.ts +9 -0
- package/templates/svelte-tailwind/src/main.ts +16 -0
- package/templates/svelte-tailwind/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/svelte-tailwind/src/modules/todos/todo.queries.ts +5 -0
- package/templates/svelte-tailwind/src/modules/todos/todo.schema.ts +10 -0
- package/templates/svelte-tailwind/src/modules/todos/useTodos.ts +25 -0
- package/templates/svelte-tailwind/src/schema.ts +9 -0
- package/templates/svelte-tailwind/src/vite-env.d.ts +12 -0
- package/templates/svelte-tailwind/svelte.config.js +5 -0
- package/templates/svelte-tailwind/tsconfig.json.hbs +14 -0
- package/templates/svelte-tailwind/vite.config.ts +53 -0
- package/templates/svelte-tailwind-sync/.env.example +25 -0
- package/templates/svelte-tailwind-sync/README.md.hbs +105 -0
- package/templates/svelte-tailwind-sync/index.html.hbs +12 -0
- package/templates/svelte-tailwind-sync/kora.config.ts +17 -0
- package/templates/svelte-tailwind-sync/package.json.hbs +46 -0
- package/templates/svelte-tailwind-sync/server.ts +90 -0
- package/templates/svelte-tailwind-sync/src/App.svelte +196 -0
- package/templates/svelte-tailwind-sync/src/Root.svelte +26 -0
- package/templates/svelte-tailwind-sync/src/auth.ts +25 -0
- package/templates/svelte-tailwind-sync/src/index.css +7 -0
- package/templates/svelte-tailwind-sync/src/kora-worker.ts +9 -0
- package/templates/svelte-tailwind-sync/src/main.ts +32 -0
- package/templates/svelte-tailwind-sync/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/svelte-tailwind-sync/src/modules/todos/todo.queries.ts +5 -0
- package/templates/svelte-tailwind-sync/src/modules/todos/todo.schema.ts +10 -0
- package/templates/svelte-tailwind-sync/src/modules/todos/useTodos.ts +25 -0
- package/templates/svelte-tailwind-sync/src/schema.ts +9 -0
- package/templates/svelte-tailwind-sync/src/vite-env.d.ts +21 -0
- package/templates/svelte-tailwind-sync/svelte.config.js +5 -0
- package/templates/svelte-tailwind-sync/tsconfig.json.hbs +14 -0
- package/templates/svelte-tailwind-sync/vite.config.ts +80 -0
- package/templates/tauri-react/.env.example +20 -0
- package/templates/tauri-react/README.md.hbs +36 -1
- package/templates/tauri-react/dev.ts +11 -11
- package/templates/tauri-react/package.json.hbs +2 -0
- package/templates/tauri-react/server.ts +86 -12
- package/templates/tauri-react/src/App.tsx +769 -544
- package/templates/tauri-react/src/AppShell.tsx +125 -83
- package/templates/tauri-react/src/SetupScreen.tsx +257 -208
- package/templates/tauri-react/src/auth.ts +45 -0
- package/templates/tauri-react/src/main.tsx +3 -3
- package/templates/tauri-react/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/tauri-react/src/modules/todos/todo.queries.ts +5 -0
- package/templates/tauri-react/src/modules/todos/todo.schema.ts +10 -0
- package/templates/tauri-react/src/modules/todos/useTodos.ts +31 -0
- package/templates/tauri-react/src/schema.ts +6 -12
- package/templates/tauri-react/src/sync-config.ts +47 -47
- package/templates/tauri-react/src/updater.ts +15 -15
- package/templates/tauri-react/src/vite-env.d.ts +17 -0
- package/templates/tauri-react/src-tauri/tauri.conf.json +1 -1
- package/templates/tauri-react/tsconfig.json.hbs +14 -0
- package/templates/tauri-react/vite.config.ts +9 -9
- package/templates/vue-basic/README.md.hbs +62 -0
- package/templates/vue-basic/index.html.hbs +12 -0
- package/templates/vue-basic/kora.config.ts +12 -0
- package/templates/vue-basic/package.json.hbs +26 -0
- package/templates/vue-basic/src/App.vue +117 -0
- package/templates/vue-basic/src/index.css +287 -0
- package/templates/vue-basic/src/kora-worker.ts +9 -0
- package/templates/vue-basic/src/main.ts +20 -0
- package/templates/vue-basic/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/vue-basic/src/modules/todos/todo.queries.ts +5 -0
- package/templates/vue-basic/src/modules/todos/todo.schema.ts +10 -0
- package/templates/vue-basic/src/modules/todos/useTodos.ts +32 -0
- package/templates/vue-basic/src/schema.ts +9 -0
- package/templates/vue-basic/src/vite-env.d.ts +17 -0
- package/templates/vue-basic/tsconfig.json.hbs +15 -0
- package/templates/vue-basic/vite.config.ts +69 -0
- package/templates/vue-sync/.env.example +25 -0
- package/templates/vue-sync/README.md.hbs +105 -0
- package/templates/vue-sync/index.html.hbs +12 -0
- package/templates/vue-sync/kora.config.ts +17 -0
- package/templates/vue-sync/package.json.hbs +42 -0
- package/templates/vue-sync/server.ts +90 -0
- package/templates/vue-sync/src/App.vue +135 -0
- package/templates/vue-sync/src/auth.ts +25 -0
- package/templates/vue-sync/src/index.css +339 -0
- package/templates/vue-sync/src/kora-worker.ts +9 -0
- package/templates/vue-sync/src/main.ts +43 -0
- package/templates/vue-sync/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/vue-sync/src/modules/todos/todo.queries.ts +5 -0
- package/templates/vue-sync/src/modules/todos/todo.schema.ts +10 -0
- package/templates/vue-sync/src/modules/todos/useTodos.ts +32 -0
- package/templates/vue-sync/src/schema.ts +9 -0
- package/templates/vue-sync/src/vite-env.d.ts +26 -0
- package/templates/vue-sync/tsconfig.json.hbs +15 -0
- package/templates/vue-sync/vite.config.ts +79 -0
- package/templates/vue-tailwind/README.md.hbs +62 -0
- package/templates/vue-tailwind/index.html.hbs +12 -0
- package/templates/vue-tailwind/kora.config.ts +12 -0
- package/templates/vue-tailwind/package.json.hbs +29 -0
- package/templates/vue-tailwind/src/App.vue +142 -0
- package/templates/vue-tailwind/src/index.css +7 -0
- package/templates/vue-tailwind/src/kora-worker.ts +9 -0
- package/templates/vue-tailwind/src/main.ts +31 -0
- package/templates/vue-tailwind/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/vue-tailwind/src/modules/todos/todo.queries.ts +5 -0
- package/templates/vue-tailwind/src/modules/todos/todo.schema.ts +10 -0
- package/templates/vue-tailwind/src/modules/todos/useTodos.ts +32 -0
- package/templates/vue-tailwind/src/schema.ts +9 -0
- package/templates/vue-tailwind/src/vite-env.d.ts +17 -0
- package/templates/vue-tailwind/tsconfig.json.hbs +15 -0
- package/templates/vue-tailwind/vite.config.ts +70 -0
- package/templates/vue-tailwind-sync/.env.example +25 -0
- package/templates/vue-tailwind-sync/README.md.hbs +105 -0
- package/templates/vue-tailwind-sync/index.html.hbs +12 -0
- package/templates/vue-tailwind-sync/kora.config.ts +17 -0
- package/templates/vue-tailwind-sync/package.json.hbs +45 -0
- package/templates/vue-tailwind-sync/server.ts +90 -0
- package/templates/vue-tailwind-sync/src/App.vue +245 -0
- package/templates/vue-tailwind-sync/src/auth.ts +25 -0
- package/templates/vue-tailwind-sync/src/index.css +7 -0
- package/templates/vue-tailwind-sync/src/kora-worker.ts +9 -0
- package/templates/vue-tailwind-sync/src/main.ts +56 -0
- package/templates/vue-tailwind-sync/src/modules/todos/todo.mutations.ts +25 -0
- package/templates/vue-tailwind-sync/src/modules/todos/todo.queries.ts +5 -0
- package/templates/vue-tailwind-sync/src/modules/todos/todo.schema.ts +10 -0
- package/templates/vue-tailwind-sync/src/modules/todos/useTodos.ts +32 -0
- package/templates/vue-tailwind-sync/src/schema.ts +9 -0
- package/templates/vue-tailwind-sync/src/vite-env.d.ts +26 -0
- package/templates/vue-tailwind-sync/tsconfig.json.hbs +15 -0
- package/templates/vue-tailwind-sync/vite.config.ts +80 -0
- package/dist/chunk-CMSX76KM.js.map +0 -1
- package/dist/chunk-MVP5PDT4.js.map +0 -1
- package/dist/chunk-YGVO4POI.js.map +0 -1
- package/templates/tauri-react/tsconfig.json +0 -15
package/dist/index.cjs
CHANGED
|
@@ -92,6 +92,14 @@ var TEMPLATES = [
|
|
|
92
92
|
"react-tailwind",
|
|
93
93
|
"react-sync",
|
|
94
94
|
"react-basic",
|
|
95
|
+
"vue-sync",
|
|
96
|
+
"vue-basic",
|
|
97
|
+
"vue-tailwind-sync",
|
|
98
|
+
"vue-tailwind",
|
|
99
|
+
"svelte-sync",
|
|
100
|
+
"svelte-basic",
|
|
101
|
+
"svelte-tailwind-sync",
|
|
102
|
+
"svelte-tailwind",
|
|
95
103
|
"tauri-react"
|
|
96
104
|
];
|
|
97
105
|
var TEMPLATE_INFO = [
|
|
@@ -115,6 +123,46 @@ var TEMPLATE_INFO = [
|
|
|
115
123
|
label: "React + CSS (local-only)",
|
|
116
124
|
description: "Clean CSS app \u2014 no sync server"
|
|
117
125
|
},
|
|
126
|
+
{
|
|
127
|
+
name: "vue-sync",
|
|
128
|
+
label: "Vue 3 + CSS (with sync)",
|
|
129
|
+
description: "Vue composables with sync server included"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "vue-basic",
|
|
133
|
+
label: "Vue 3 + CSS (local-only)",
|
|
134
|
+
description: "Vue composables \u2014 no sync server"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "vue-tailwind-sync",
|
|
138
|
+
label: "Vue 3 + Tailwind (with sync)",
|
|
139
|
+
description: "Polished Vue app with Tailwind CSS and sync server"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "vue-tailwind",
|
|
143
|
+
label: "Vue 3 + Tailwind (local-only)",
|
|
144
|
+
description: "Polished Vue app with Tailwind CSS \u2014 no sync server"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "svelte-sync",
|
|
148
|
+
label: "Svelte 5 + CSS (with sync)",
|
|
149
|
+
description: "Svelte stores with sync server included"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "svelte-basic",
|
|
153
|
+
label: "Svelte 5 + CSS (local-only)",
|
|
154
|
+
description: "Svelte stores \u2014 no sync server"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "svelte-tailwind-sync",
|
|
158
|
+
label: "Svelte 5 + Tailwind (with sync)",
|
|
159
|
+
description: "Polished Svelte app with Tailwind CSS and sync server"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "svelte-tailwind",
|
|
163
|
+
label: "Svelte 5 + Tailwind (local-only)",
|
|
164
|
+
description: "Polished Svelte app with Tailwind CSS \u2014 no sync server"
|
|
165
|
+
},
|
|
118
166
|
{
|
|
119
167
|
name: "tauri-react",
|
|
120
168
|
label: "Tauri Desktop (native SQLite)",
|
|
@@ -279,6 +327,7 @@ function toPascalCase(name) {
|
|
|
279
327
|
}
|
|
280
328
|
|
|
281
329
|
// src/commands/deploy/deploy-command.ts
|
|
330
|
+
var import_node_fs2 = require("fs");
|
|
282
331
|
var import_node_path12 = require("path");
|
|
283
332
|
var import_citty = require("citty");
|
|
284
333
|
|
|
@@ -778,13 +827,13 @@ var AwsEcsAdapter = class {
|
|
|
778
827
|
projectRoot: config.projectRoot,
|
|
779
828
|
deployDirectory
|
|
780
829
|
});
|
|
781
|
-
const client = await buildClient({
|
|
830
|
+
const client = config.deployTarget === "sync-server" ? null : await buildClient({
|
|
782
831
|
projectRoot: config.projectRoot,
|
|
783
832
|
outDir: (0, import_node_path4.join)(deployDirectory, "dist"),
|
|
784
833
|
mode: "production"
|
|
785
834
|
});
|
|
786
835
|
return {
|
|
787
|
-
clientDirectory: client
|
|
836
|
+
clientDirectory: client?.outDir ?? null,
|
|
788
837
|
serverBundlePath: (0, import_node_path4.join)(deployDirectory, "server-bundled.js"),
|
|
789
838
|
deployDirectory
|
|
790
839
|
};
|
|
@@ -1129,13 +1178,13 @@ var AwsLightsailAdapter = class {
|
|
|
1129
1178
|
projectRoot: config.projectRoot,
|
|
1130
1179
|
deployDirectory
|
|
1131
1180
|
});
|
|
1132
|
-
const client = await buildClient({
|
|
1181
|
+
const client = config.deployTarget === "sync-server" ? null : await buildClient({
|
|
1133
1182
|
projectRoot: config.projectRoot,
|
|
1134
1183
|
outDir: (0, import_node_path5.join)(deployDirectory, "dist"),
|
|
1135
1184
|
mode: "production"
|
|
1136
1185
|
});
|
|
1137
1186
|
return {
|
|
1138
|
-
clientDirectory: client
|
|
1187
|
+
clientDirectory: client?.outDir ?? null,
|
|
1139
1188
|
serverBundlePath: (0, import_node_path5.join)(deployDirectory, "server-bundled.js"),
|
|
1140
1189
|
deployDirectory
|
|
1141
1190
|
};
|
|
@@ -1465,7 +1514,7 @@ function generateFlyToml(options) {
|
|
|
1465
1514
|
' interval = "30s"',
|
|
1466
1515
|
' method = "GET"',
|
|
1467
1516
|
' timeout = "5s"',
|
|
1468
|
-
' path = "/"',
|
|
1517
|
+
' path = "/health"',
|
|
1469
1518
|
""
|
|
1470
1519
|
].join("\n");
|
|
1471
1520
|
}
|
|
@@ -1575,13 +1624,13 @@ var FlyAdapter = class {
|
|
|
1575
1624
|
projectRoot: config.projectRoot,
|
|
1576
1625
|
deployDirectory
|
|
1577
1626
|
});
|
|
1578
|
-
const client = await buildClient({
|
|
1627
|
+
const client = config.deployTarget === "sync-server" ? null : await buildClient({
|
|
1579
1628
|
projectRoot: config.projectRoot,
|
|
1580
1629
|
outDir: (0, import_node_path7.join)(deployDirectory, "dist"),
|
|
1581
1630
|
mode: "production"
|
|
1582
1631
|
});
|
|
1583
1632
|
return {
|
|
1584
|
-
clientDirectory: client
|
|
1633
|
+
clientDirectory: client?.outDir ?? null,
|
|
1585
1634
|
serverBundlePath: (0, import_node_path7.join)(deployDirectory, "server-bundled.js"),
|
|
1586
1635
|
deployDirectory
|
|
1587
1636
|
};
|
|
@@ -1933,13 +1982,13 @@ var RailwayAdapter = class {
|
|
|
1933
1982
|
projectRoot: config.projectRoot,
|
|
1934
1983
|
deployDirectory
|
|
1935
1984
|
});
|
|
1936
|
-
const client = await buildClient({
|
|
1985
|
+
const client = config.deployTarget === "sync-server" ? null : await buildClient({
|
|
1937
1986
|
projectRoot: config.projectRoot,
|
|
1938
1987
|
outDir: (0, import_node_path9.join)(deployDirectory, "dist"),
|
|
1939
1988
|
mode: "production"
|
|
1940
1989
|
});
|
|
1941
1990
|
return {
|
|
1942
|
-
clientDirectory: client
|
|
1991
|
+
clientDirectory: client?.outDir ?? null,
|
|
1943
1992
|
serverBundlePath: (0, import_node_path9.join)(deployDirectory, "server-bundled.js"),
|
|
1944
1993
|
deployDirectory
|
|
1945
1994
|
};
|
|
@@ -2231,7 +2280,7 @@ var GENERATED_HEADER3 = "# Generated by kora deploy \u2014 do not edit manually"
|
|
|
2231
2280
|
function generateDockerfile(options = {}) {
|
|
2232
2281
|
const nodeVersion = options.nodeVersion ?? "20-alpine";
|
|
2233
2282
|
const port = options.port ?? 3e3;
|
|
2234
|
-
const clientDirectory = options.clientDirectory
|
|
2283
|
+
const clientDirectory = options.clientDirectory === void 0 ? "dist" : options.clientDirectory;
|
|
2235
2284
|
const serverBundleFile = options.serverBundleFile ?? "server-bundled.js";
|
|
2236
2285
|
const hasNativeDeps = options.nativeDependencies && Object.keys(options.nativeDependencies).length > 0;
|
|
2237
2286
|
const lines = [
|
|
@@ -2251,7 +2300,9 @@ function generateDockerfile(options = {}) {
|
|
|
2251
2300
|
lines.push("RUN npm install --omit=dev");
|
|
2252
2301
|
lines.push("");
|
|
2253
2302
|
}
|
|
2254
|
-
|
|
2303
|
+
if (clientDirectory !== null) {
|
|
2304
|
+
lines.push(`COPY ${clientDirectory} ./dist`);
|
|
2305
|
+
}
|
|
2255
2306
|
lines.push(`COPY ${serverBundleFile} ./server-bundled.js`);
|
|
2256
2307
|
lines.push("");
|
|
2257
2308
|
lines.push(`EXPOSE ${String(port)}`);
|
|
@@ -2576,12 +2627,14 @@ var deployCommand = (0, import_citty.defineCommand)({
|
|
|
2576
2627
|
const region = resolveRegion(args.region, existingState?.region, confirmMode);
|
|
2577
2628
|
const deployDirectory = resolveDeployDirectory(projectRoot);
|
|
2578
2629
|
const environment = args.prod === true ? "production" : "preview";
|
|
2630
|
+
const deployTarget = detectDeployTarget(projectRoot);
|
|
2579
2631
|
const config = {
|
|
2580
2632
|
projectRoot,
|
|
2581
2633
|
appName,
|
|
2582
2634
|
region,
|
|
2583
2635
|
environment,
|
|
2584
|
-
confirm: confirmMode
|
|
2636
|
+
confirm: confirmMode,
|
|
2637
|
+
deployTarget
|
|
2585
2638
|
};
|
|
2586
2639
|
const adapter = createDeployAdapter(platform);
|
|
2587
2640
|
configureAdapterContext(adapter, {
|
|
@@ -2593,10 +2646,14 @@ var deployCommand = (0, import_citty.defineCommand)({
|
|
|
2593
2646
|
logger.info(
|
|
2594
2647
|
`Deploying to ${platform} (${appName}${region ? `, ${region}` : ""}, ${environment})`
|
|
2595
2648
|
);
|
|
2649
|
+
if (deployTarget === "sync-server") {
|
|
2650
|
+
logger.step("Detected Tauri project. Deploying the sync server only.");
|
|
2651
|
+
}
|
|
2596
2652
|
if (confirmMode) {
|
|
2597
2653
|
logger.step("Running in --confirm mode (non-interactive, fail-fast).");
|
|
2598
2654
|
}
|
|
2599
2655
|
await writeDockerfileArtifact(deployDirectory, {
|
|
2656
|
+
clientDirectory: deployTarget === "sync-server" ? null : void 0,
|
|
2600
2657
|
nativeDependencies: {
|
|
2601
2658
|
"better-sqlite3": "^11.0.0",
|
|
2602
2659
|
"drizzle-orm": "^0.45.2",
|
|
@@ -2735,6 +2792,9 @@ function configureAdapterContext(adapter, context) {
|
|
|
2735
2792
|
adapter.setContext(context);
|
|
2736
2793
|
}
|
|
2737
2794
|
}
|
|
2795
|
+
function detectDeployTarget(projectRoot) {
|
|
2796
|
+
return (0, import_node_fs2.existsSync)((0, import_node_path12.join)(projectRoot, "src-tauri")) ? "sync-server" : "full-stack";
|
|
2797
|
+
}
|
|
2738
2798
|
function hasContextSetter(adapter) {
|
|
2739
2799
|
return typeof adapter.setContext === "function";
|
|
2740
2800
|
}
|
|
@@ -2767,6 +2827,19 @@ function validateProjectName(name) {
|
|
|
2767
2827
|
function determineTemplateFromSelections(input) {
|
|
2768
2828
|
if (input.platform === "desktop-tauri") return "tauri-react";
|
|
2769
2829
|
const shouldSync = input.sync && input.db !== "none";
|
|
2830
|
+
if (input.framework === "vue") {
|
|
2831
|
+
if (input.tailwind && shouldSync) return "vue-tailwind-sync";
|
|
2832
|
+
if (input.tailwind && !shouldSync) return "vue-tailwind";
|
|
2833
|
+
return shouldSync ? "vue-sync" : "vue-basic";
|
|
2834
|
+
}
|
|
2835
|
+
if (input.framework === "svelte") {
|
|
2836
|
+
if (input.tailwind && shouldSync) return "svelte-tailwind-sync";
|
|
2837
|
+
if (input.tailwind && !shouldSync) return "svelte-tailwind";
|
|
2838
|
+
return shouldSync ? "svelte-sync" : "svelte-basic";
|
|
2839
|
+
}
|
|
2840
|
+
if (input.framework === "solid") {
|
|
2841
|
+
throw new Error("Solid templates are not available yet. Use react, vue, or svelte.");
|
|
2842
|
+
}
|
|
2770
2843
|
if (input.tailwind && shouldSync) return "react-tailwind-sync";
|
|
2771
2844
|
if (input.tailwind && !shouldSync) return "react-tailwind";
|
|
2772
2845
|
if (!input.tailwind && shouldSync) return "react-sync";
|
|
@@ -2863,10 +2936,49 @@ async function resolveCreatePreferencesFlow(params) {
|
|
|
2863
2936
|
if (isTauri) {
|
|
2864
2937
|
effective.framework = "react";
|
|
2865
2938
|
effective.tailwind = false;
|
|
2866
|
-
effective.sync = true;
|
|
2867
|
-
effective.db = "sqlite";
|
|
2868
|
-
effective.dbProvider = "none";
|
|
2869
2939
|
effective.auth = "none";
|
|
2940
|
+
if (flags.sync !== void 0) {
|
|
2941
|
+
effective.sync = flags.sync;
|
|
2942
|
+
} else if (!flags.useDefaults && !usedStoredPreferences) {
|
|
2943
|
+
effective.sync = await prompts.confirm("Enable multi-device sync?", true);
|
|
2944
|
+
}
|
|
2945
|
+
if (flags.db !== void 0) {
|
|
2946
|
+
if (!isDatabaseValue(flags.db)) {
|
|
2947
|
+
throw new Error(
|
|
2948
|
+
`Invalid --db value "${flags.db}". Expected one of: none, sqlite, postgres.`
|
|
2949
|
+
);
|
|
2950
|
+
}
|
|
2951
|
+
effective.db = flags.db;
|
|
2952
|
+
} else if (!effective.sync) {
|
|
2953
|
+
effective.db = "none";
|
|
2954
|
+
} else if (!flags.useDefaults && !usedStoredPreferences) {
|
|
2955
|
+
effective.db = await prompts.select("Sync server database:", [
|
|
2956
|
+
{ label: "SQLite (zero-config; local, LAN, small teams)", value: "sqlite" },
|
|
2957
|
+
{ label: "PostgreSQL (production-scale)", value: "postgres" }
|
|
2958
|
+
]);
|
|
2959
|
+
}
|
|
2960
|
+
if (effective.db === "none") {
|
|
2961
|
+
effective.sync = false;
|
|
2962
|
+
}
|
|
2963
|
+
if (effective.db !== "postgres") {
|
|
2964
|
+
effective.dbProvider = "none";
|
|
2965
|
+
} else if (flags.dbProvider !== void 0) {
|
|
2966
|
+
if (!isDatabaseProviderValue(flags.dbProvider)) {
|
|
2967
|
+
throw new Error(
|
|
2968
|
+
`Invalid --db-provider value "${flags.dbProvider}". Expected one of: none, local, supabase, neon, railway, vercel-postgres, custom.`
|
|
2969
|
+
);
|
|
2970
|
+
}
|
|
2971
|
+
effective.dbProvider = flags.dbProvider;
|
|
2972
|
+
} else if (!flags.useDefaults && !usedStoredPreferences) {
|
|
2973
|
+
effective.dbProvider = await prompts.select("Database provider:", [
|
|
2974
|
+
{ label: "Local Postgres", value: "local" },
|
|
2975
|
+
{ label: "Supabase", value: "supabase" },
|
|
2976
|
+
{ label: "Neon", value: "neon" },
|
|
2977
|
+
{ label: "Railway", value: "railway" },
|
|
2978
|
+
{ label: "Vercel Postgres", value: "vercel-postgres" },
|
|
2979
|
+
{ label: "Custom connection string", value: "custom" }
|
|
2980
|
+
]);
|
|
2981
|
+
}
|
|
2870
2982
|
} else {
|
|
2871
2983
|
if (flags.framework !== void 0) {
|
|
2872
2984
|
if (!isFrameworkValue(flags.framework)) {
|
|
@@ -2878,8 +2990,8 @@ async function resolveCreatePreferencesFlow(params) {
|
|
|
2878
2990
|
} else if (!flags.useDefaults && !usedStoredPreferences) {
|
|
2879
2991
|
effective.framework = await prompts.select("UI framework:", [
|
|
2880
2992
|
{ label: "React", value: "react" },
|
|
2881
|
-
{ label: "Vue
|
|
2882
|
-
{ label: "Svelte
|
|
2993
|
+
{ label: "Vue 3", value: "vue" },
|
|
2994
|
+
{ label: "Svelte 5", value: "svelte" },
|
|
2883
2995
|
{ label: "Solid (coming soon)", value: "solid", disabled: true }
|
|
2884
2996
|
]);
|
|
2885
2997
|
}
|
|
@@ -2944,6 +3056,7 @@ async function resolveCreatePreferencesFlow(params) {
|
|
|
2944
3056
|
}
|
|
2945
3057
|
const template = determineTemplateFromSelections({
|
|
2946
3058
|
platform: effective.platform,
|
|
3059
|
+
framework: effective.framework,
|
|
2947
3060
|
tailwind: effective.tailwind,
|
|
2948
3061
|
sync: effective.sync,
|
|
2949
3062
|
db: effective.db
|
|
@@ -3002,67 +3115,35 @@ async function applySyncProviderPreset(options) {
|
|
|
3002
3115
|
}
|
|
3003
3116
|
const providerName = getProviderDisplayName(options.dbProvider);
|
|
3004
3117
|
const providerConnectionString = getProviderConnectionStringExample(options.dbProvider);
|
|
3005
|
-
const serverPath = (0, import_node_path13.join)(options.targetDir, "server.ts");
|
|
3006
3118
|
const envPath = (0, import_node_path13.join)(options.targetDir, ".env.example");
|
|
3007
3119
|
const readmePath = (0, import_node_path13.join)(options.targetDir, "README.md");
|
|
3008
|
-
const serverTemplate = [
|
|
3009
|
-
"import { createPostgresServerStore, createProductionServer } from '@korajs/server'",
|
|
3010
|
-
"",
|
|
3011
|
-
`// PostgreSQL provider preset: ${providerName}`,
|
|
3012
|
-
"// Ensure DATABASE_URL is set in your environment.",
|
|
3013
|
-
"",
|
|
3014
|
-
"async function start(): Promise<void> {",
|
|
3015
|
-
" const connectionString = process.env.DATABASE_URL || ''",
|
|
3016
|
-
" if (connectionString.length === 0) {",
|
|
3017
|
-
" throw new Error('DATABASE_URL is required for PostgreSQL sync server store.')",
|
|
3018
|
-
" }",
|
|
3019
|
-
"",
|
|
3020
|
-
" const store = await createPostgresServerStore({ connectionString })",
|
|
3021
|
-
" const server = createProductionServer({",
|
|
3022
|
-
" store,",
|
|
3023
|
-
" port: Number(process.env.PORT) || 3001,",
|
|
3024
|
-
" staticDir: './dist',",
|
|
3025
|
-
" syncPath: '/kora-sync',",
|
|
3026
|
-
" })",
|
|
3027
|
-
"",
|
|
3028
|
-
" const url = await server.start()",
|
|
3029
|
-
" console.log(`Kora app running at ${url}`)",
|
|
3030
|
-
"}",
|
|
3031
|
-
"",
|
|
3032
|
-
"void start()",
|
|
3033
|
-
""
|
|
3034
|
-
].join("\n");
|
|
3035
|
-
const envTemplate = [
|
|
3036
|
-
"# Kora Sync Server",
|
|
3037
|
-
"# WebSocket URL for the sync server (used by the client)",
|
|
3038
|
-
"VITE_SYNC_URL=ws://localhost:3001",
|
|
3039
|
-
"",
|
|
3040
|
-
"# Sync server port",
|
|
3041
|
-
"PORT=3001",
|
|
3042
|
-
"",
|
|
3043
|
-
`# PostgreSQL connection string (${providerName})`,
|
|
3044
|
-
`# Example: ${providerConnectionString}`,
|
|
3045
|
-
"DATABASE_URL=",
|
|
3046
|
-
""
|
|
3047
|
-
].join("\n");
|
|
3048
3120
|
const existingReadme = await (0, import_promises9.readFile)(readmePath, "utf-8");
|
|
3121
|
+
const existingEnv = await (0, import_promises9.readFile)(envPath, "utf-8");
|
|
3049
3122
|
const trimmedReadme = existingReadme.trimEnd();
|
|
3123
|
+
const trimmedEnv = existingEnv.trimEnd();
|
|
3124
|
+
const envSuffix = [
|
|
3125
|
+
"",
|
|
3126
|
+
`# PostgreSQL provider preset: ${providerName}`,
|
|
3127
|
+
`# Example: ${providerConnectionString}`
|
|
3128
|
+
].join("\n");
|
|
3050
3129
|
const readmeSuffix = [
|
|
3051
3130
|
"",
|
|
3052
3131
|
"## PostgreSQL Provider Preset",
|
|
3053
3132
|
"",
|
|
3054
3133
|
`Selected DB provider: ${options.dbProvider}`,
|
|
3055
3134
|
"",
|
|
3056
|
-
"This scaffold
|
|
3135
|
+
"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`.",
|
|
3136
|
+
"",
|
|
3137
|
+
"The generated server uses `createPostgresServerStore` automatically when `DATABASE_URL` is present.",
|
|
3057
3138
|
""
|
|
3058
3139
|
].join("\n");
|
|
3059
3140
|
const readmeTemplate = `${trimmedReadme}${readmeSuffix}`;
|
|
3060
|
-
await (0, import_promises9.writeFile)(
|
|
3061
|
-
|
|
3141
|
+
await (0, import_promises9.writeFile)(envPath, `${trimmedEnv}${envSuffix}
|
|
3142
|
+
`, "utf-8");
|
|
3062
3143
|
await (0, import_promises9.writeFile)(readmePath, readmeTemplate, "utf-8");
|
|
3063
3144
|
}
|
|
3064
3145
|
function isSyncTemplate(template) {
|
|
3065
|
-
return template === "react-sync" || template === "react-tailwind-sync" || template === "tauri-react";
|
|
3146
|
+
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";
|
|
3066
3147
|
}
|
|
3067
3148
|
function getProviderDisplayName(provider) {
|
|
3068
3149
|
switch (provider) {
|