@korajs/cli 0.3.4 → 0.5.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 (104) hide show
  1. package/dist/bin.cjs +1839 -829
  2. package/dist/bin.cjs.map +1 -1
  3. package/dist/bin.js +1107 -146
  4. package/dist/bin.js.map +1 -1
  5. package/dist/{chunk-HNVCNPER.js → chunk-3WNFM3QB.js} +107 -97
  6. package/dist/chunk-3WNFM3QB.js.map +1 -0
  7. package/dist/{chunk-ULTO5NFA.js → chunk-PSRM56B7.js} +2 -2
  8. package/dist/chunk-PSRM56B7.js.map +1 -0
  9. package/dist/{chunk-MIMLCXSX.js → chunk-SOTZIWIF.js} +267 -228
  10. package/dist/chunk-SOTZIWIF.js.map +1 -0
  11. package/dist/create.cjs +58 -48
  12. package/dist/create.cjs.map +1 -1
  13. package/dist/create.js +2 -2
  14. package/dist/index.cjs +322 -273
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +31 -29
  17. package/dist/index.d.ts +31 -29
  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/tauri-react/.env.example +20 -0
  81. package/templates/tauri-react/README.md.hbs +36 -1
  82. package/templates/tauri-react/dev.ts +11 -11
  83. package/templates/tauri-react/package.json.hbs +2 -0
  84. package/templates/tauri-react/server.ts +86 -12
  85. package/templates/tauri-react/src/App.tsx +769 -544
  86. package/templates/tauri-react/src/AppShell.tsx +125 -83
  87. package/templates/tauri-react/src/SetupScreen.tsx +257 -208
  88. package/templates/tauri-react/src/auth.ts +45 -0
  89. package/templates/tauri-react/src/main.tsx +3 -3
  90. package/templates/tauri-react/src/modules/todos/todo.mutations.ts +25 -0
  91. package/templates/tauri-react/src/modules/todos/todo.queries.ts +5 -0
  92. package/templates/tauri-react/src/modules/todos/todo.schema.ts +10 -0
  93. package/templates/tauri-react/src/modules/todos/useTodos.ts +31 -0
  94. package/templates/tauri-react/src/schema.ts +6 -12
  95. package/templates/tauri-react/src/sync-config.ts +47 -47
  96. package/templates/tauri-react/src/updater.ts +15 -15
  97. package/templates/tauri-react/src/vite-env.d.ts +17 -0
  98. package/templates/tauri-react/src-tauri/tauri.conf.json +2 -2
  99. package/templates/tauri-react/tsconfig.json.hbs +14 -0
  100. package/templates/tauri-react/vite.config.ts +9 -9
  101. package/dist/chunk-HNVCNPER.js.map +0 -1
  102. package/dist/chunk-MIMLCXSX.js.map +0 -1
  103. package/dist/chunk-ULTO5NFA.js.map +0 -1
  104. package/templates/tauri-react/tsconfig.json +0 -15
@@ -5,18 +5,26 @@ import {
5
5
  createPromptClient,
6
6
  findProjectRoot,
7
7
  resolveProjectBinaryEntryPoint
8
- } from "./chunk-HNVCNPER.js";
8
+ } from "./chunk-3WNFM3QB.js";
9
9
 
10
10
  // src/commands/deploy/adapters/adapter.ts
11
- var DEPLOY_PLATFORMS = ["fly", "railway", "aws-ecs", "aws-lightsail", "render", "docker", "kora-cloud"];
11
+ var DEPLOY_PLATFORMS = [
12
+ "fly",
13
+ "railway",
14
+ "aws-ecs",
15
+ "aws-lightsail",
16
+ "render",
17
+ "docker",
18
+ "kora-cloud"
19
+ ];
12
20
  function isDeployPlatform(value) {
13
21
  return DEPLOY_PLATFORMS.includes(value);
14
22
  }
15
23
 
16
24
  // src/commands/deploy/builder/client-builder.ts
17
25
  import { spawn } from "child_process";
18
- import { copyFile, readdir } from "fs/promises";
19
26
  import { existsSync } from "fs";
27
+ import { copyFile, readdir } from "fs/promises";
20
28
  import { join, resolve } from "path";
21
29
  async function buildClient(options) {
22
30
  const viteEntryPoint = await resolveProjectBinaryEntryPoint(options.projectRoot, "vite", "vite");
@@ -159,7 +167,7 @@ function generateFlyToml(options) {
159
167
  ' interval = "30s"',
160
168
  ' method = "GET"',
161
169
  ' timeout = "5s"',
162
- ' path = "/"',
170
+ ' path = "/health"',
163
171
  ""
164
172
  ].join("\n");
165
173
  }
@@ -271,13 +279,13 @@ var FlyAdapter = class {
271
279
  projectRoot: config.projectRoot,
272
280
  deployDirectory
273
281
  });
274
- const client = await buildClient({
282
+ const client = config.deployTarget === "sync-server" ? null : await buildClient({
275
283
  projectRoot: config.projectRoot,
276
284
  outDir: join4(deployDirectory, "dist"),
277
285
  mode: "production"
278
286
  });
279
287
  return {
280
- clientDirectory: client.outDir,
288
+ clientDirectory: client?.outDir ?? null,
281
289
  serverBundlePath: join4(deployDirectory, "server-bundled.js"),
282
290
  deployDirectory
283
291
  };
@@ -627,13 +635,13 @@ var RailwayAdapter = class {
627
635
  projectRoot: config.projectRoot,
628
636
  deployDirectory
629
637
  });
630
- const client = await buildClient({
638
+ const client = config.deployTarget === "sync-server" ? null : await buildClient({
631
639
  projectRoot: config.projectRoot,
632
640
  outDir: join6(deployDirectory, "dist"),
633
641
  mode: "production"
634
642
  });
635
643
  return {
636
- clientDirectory: client.outDir,
644
+ clientDirectory: client?.outDir ?? null,
637
645
  serverBundlePath: join6(deployDirectory, "server-bundled.js"),
638
646
  deployDirectory
639
647
  };
@@ -940,37 +948,46 @@ var AwsEcsAdapter = class {
940
948
  };
941
949
  const region = config.region ?? "us-east-1";
942
950
  const repoName = `kora/${config.appName}`;
943
- const createRepo = await this.runner.run("aws", [
944
- "ecr",
945
- "create-repository",
946
- "--repository-name",
947
- repoName,
948
- "--region",
949
- region,
950
- "--image-scanning-configuration",
951
- "scanOnPush=true"
952
- ], config.projectRoot);
951
+ const createRepo = await this.runner.run(
952
+ "aws",
953
+ [
954
+ "ecr",
955
+ "create-repository",
956
+ "--repository-name",
957
+ repoName,
958
+ "--region",
959
+ region,
960
+ "--image-scanning-configuration",
961
+ "scanOnPush=true"
962
+ ],
963
+ config.projectRoot
964
+ );
953
965
  if (createRepo.exitCode !== 0 && !createRepo.stderr.includes("RepositoryAlreadyExistsException")) {
954
966
  throw new Error(`Failed to create ECR repository: ${createRepo.stderr}`);
955
967
  }
956
- const identity = await this.runner.run("aws", ["sts", "get-caller-identity", "--query", "Account", "--output", "text"], config.projectRoot);
968
+ const identity = await this.runner.run(
969
+ "aws",
970
+ ["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
971
+ config.projectRoot
972
+ );
957
973
  const accountId = identity.stdout.trim();
958
- await this.runner.run("aws", [
959
- "ecs",
960
- "create-cluster",
961
- "--cluster-name",
962
- config.appName,
963
- "--region",
964
- region
965
- ], config.projectRoot);
966
- await this.runner.run("aws", [
967
- "logs",
968
- "create-log-group",
969
- "--log-group-name",
970
- `/ecs/${config.appName}`,
971
- "--region",
972
- region
973
- ], config.projectRoot);
974
+ await this.runner.run(
975
+ "aws",
976
+ ["ecs", "create-cluster", "--cluster-name", config.appName, "--region", region],
977
+ config.projectRoot
978
+ );
979
+ await this.runner.run(
980
+ "aws",
981
+ [
982
+ "logs",
983
+ "create-log-group",
984
+ "--log-group-name",
985
+ `/ecs/${config.appName}`,
986
+ "--region",
987
+ region
988
+ ],
989
+ config.projectRoot
990
+ );
974
991
  return {
975
992
  applicationId: `${accountId}.dkr.ecr.${region}.amazonaws.com/${repoName}`,
976
993
  databaseId: null,
@@ -988,13 +1005,13 @@ var AwsEcsAdapter = class {
988
1005
  projectRoot: config.projectRoot,
989
1006
  deployDirectory
990
1007
  });
991
- const client = await buildClient({
1008
+ const client = config.deployTarget === "sync-server" ? null : await buildClient({
992
1009
  projectRoot: config.projectRoot,
993
1010
  outDir: join7(deployDirectory, "dist"),
994
1011
  mode: "production"
995
1012
  });
996
1013
  return {
997
- clientDirectory: client.outDir,
1014
+ clientDirectory: client?.outDir ?? null,
998
1015
  serverBundlePath: join7(deployDirectory, "server-bundled.js"),
999
1016
  deployDirectory
1000
1017
  };
@@ -1003,50 +1020,42 @@ var AwsEcsAdapter = class {
1003
1020
  const context = this.requireContext();
1004
1021
  const region = context.region ?? "us-east-1";
1005
1022
  const repoName = `kora/${context.appName}`;
1006
- const loginPassword = await this.runner.run("aws", [
1007
- "ecr",
1008
- "get-login-password",
1009
- "--region",
1010
- region
1011
- ], context.projectRoot);
1023
+ const loginPassword = await this.runner.run(
1024
+ "aws",
1025
+ ["ecr", "get-login-password", "--region", region],
1026
+ context.projectRoot
1027
+ );
1012
1028
  if (loginPassword.exitCode !== 0) {
1013
1029
  throw new Error(`ECR login failed: ${loginPassword.stderr}`);
1014
1030
  }
1015
- const identity = await this.runner.run("aws", [
1016
- "sts",
1017
- "get-caller-identity",
1018
- "--query",
1019
- "Account",
1020
- "--output",
1021
- "text"
1022
- ], context.projectRoot);
1031
+ const identity = await this.runner.run(
1032
+ "aws",
1033
+ ["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
1034
+ context.projectRoot
1035
+ );
1023
1036
  const accountId = identity.stdout.trim();
1024
1037
  const ecrUri = `${accountId}.dkr.ecr.${region}.amazonaws.com`;
1025
1038
  const imageUri = `${ecrUri}/${repoName}:latest`;
1026
- const dockerLogin = await this.runner.run("docker", [
1027
- "login",
1028
- "--username",
1029
- "AWS",
1030
- "--password-stdin",
1031
- ecrUri
1032
- ], artifacts.deployDirectory);
1039
+ const dockerLogin = await this.runner.run(
1040
+ "docker",
1041
+ ["login", "--username", "AWS", "--password-stdin", ecrUri],
1042
+ artifacts.deployDirectory
1043
+ );
1033
1044
  this.logger.step("Building Docker image...");
1034
- const dockerBuild = await this.runner.run("docker", [
1035
- "build",
1036
- "--platform",
1037
- "linux/amd64",
1038
- "-t",
1039
- imageUri,
1040
- "."
1041
- ], artifacts.deployDirectory);
1045
+ const dockerBuild = await this.runner.run(
1046
+ "docker",
1047
+ ["build", "--platform", "linux/amd64", "-t", imageUri, "."],
1048
+ artifacts.deployDirectory
1049
+ );
1042
1050
  if (dockerBuild.exitCode !== 0) {
1043
1051
  throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
1044
1052
  }
1045
1053
  this.logger.step("Pushing image to ECR...");
1046
- const dockerPush = await this.runner.run("docker", [
1047
- "push",
1048
- imageUri
1049
- ], artifacts.deployDirectory);
1054
+ const dockerPush = await this.runner.run(
1055
+ "docker",
1056
+ ["push", imageUri],
1057
+ artifacts.deployDirectory
1058
+ );
1050
1059
  if (dockerPush.exitCode !== 0) {
1051
1060
  throw new Error(`Docker push failed: ${dockerPush.stderr}`);
1052
1061
  }
@@ -1057,52 +1066,55 @@ var AwsEcsAdapter = class {
1057
1066
  cpu: "256",
1058
1067
  memory: "512",
1059
1068
  executionRoleArn: `arn:aws:iam::${accountId}:role/ecsTaskExecutionRole`,
1060
- containerDefinitions: [{
1061
- name: context.appName,
1062
- image: imageUri,
1063
- essential: true,
1064
- portMappings: [{ containerPort: 3001, protocol: "tcp" }],
1065
- logConfiguration: {
1066
- logDriver: "awslogs",
1067
- options: {
1068
- "awslogs-group": `/ecs/${context.appName}`,
1069
- "awslogs-region": region,
1070
- "awslogs-stream-prefix": "ecs"
1069
+ containerDefinitions: [
1070
+ {
1071
+ name: context.appName,
1072
+ image: imageUri,
1073
+ essential: true,
1074
+ portMappings: [{ containerPort: 3001, protocol: "tcp" }],
1075
+ logConfiguration: {
1076
+ logDriver: "awslogs",
1077
+ options: {
1078
+ "awslogs-group": `/ecs/${context.appName}`,
1079
+ "awslogs-region": region,
1080
+ "awslogs-stream-prefix": "ecs"
1081
+ }
1082
+ },
1083
+ healthCheck: {
1084
+ command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
1085
+ interval: 30,
1086
+ timeout: 5,
1087
+ retries: 3,
1088
+ startPeriod: 60
1071
1089
  }
1072
- },
1073
- healthCheck: {
1074
- command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
1075
- interval: 30,
1076
- timeout: 5,
1077
- retries: 3,
1078
- startPeriod: 60
1079
1090
  }
1080
- }]
1091
+ ]
1081
1092
  });
1082
- const registerTask = await this.runner.run("aws", [
1083
- "ecs",
1084
- "register-task-definition",
1085
- "--cli-input-json",
1086
- taskDef,
1087
- "--region",
1088
- region
1089
- ], context.projectRoot);
1093
+ const registerTask = await this.runner.run(
1094
+ "aws",
1095
+ ["ecs", "register-task-definition", "--cli-input-json", taskDef, "--region", region],
1096
+ context.projectRoot
1097
+ );
1090
1098
  if (registerTask.exitCode !== 0) {
1091
1099
  throw new Error(`Task definition registration failed: ${registerTask.stderr}`);
1092
1100
  }
1093
- const updateService = await this.runner.run("aws", [
1094
- "ecs",
1095
- "update-service",
1096
- "--cluster",
1097
- context.appName,
1098
- "--service",
1099
- context.appName,
1100
- "--task-definition",
1101
- context.appName,
1102
- "--force-new-deployment",
1103
- "--region",
1104
- region
1105
- ], context.projectRoot);
1101
+ const updateService = await this.runner.run(
1102
+ "aws",
1103
+ [
1104
+ "ecs",
1105
+ "update-service",
1106
+ "--cluster",
1107
+ context.appName,
1108
+ "--service",
1109
+ context.appName,
1110
+ "--task-definition",
1111
+ context.appName,
1112
+ "--force-new-deployment",
1113
+ "--region",
1114
+ region
1115
+ ],
1116
+ context.projectRoot
1117
+ );
1106
1118
  const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
1107
1119
  if (updateService.exitCode !== 0) {
1108
1120
  this.logger.step("Service not found, creating new service...");
@@ -1127,19 +1139,23 @@ var AwsEcsAdapter = class {
1127
1139
  async rollback(deploymentId) {
1128
1140
  const context = this.requireContext();
1129
1141
  const region = context.region ?? "us-east-1";
1130
- const result = await this.runner.run("aws", [
1131
- "ecs",
1132
- "update-service",
1133
- "--cluster",
1134
- context.appName,
1135
- "--service",
1136
- context.appName,
1137
- "--task-definition",
1138
- `${context.appName}:${deploymentId}`,
1139
- "--force-new-deployment",
1140
- "--region",
1141
- region
1142
- ], context.projectRoot);
1142
+ const result = await this.runner.run(
1143
+ "aws",
1144
+ [
1145
+ "ecs",
1146
+ "update-service",
1147
+ "--cluster",
1148
+ context.appName,
1149
+ "--service",
1150
+ context.appName,
1151
+ "--task-definition",
1152
+ `${context.appName}:${deploymentId}`,
1153
+ "--force-new-deployment",
1154
+ "--region",
1155
+ region
1156
+ ],
1157
+ context.projectRoot
1158
+ );
1143
1159
  if (result.exitCode !== 0) {
1144
1160
  throw new Error(`ECS rollback failed: ${result.stderr}`);
1145
1161
  }
@@ -1182,16 +1198,20 @@ var AwsEcsAdapter = class {
1182
1198
  async status() {
1183
1199
  const context = this.requireContext();
1184
1200
  const region = context.region ?? "us-east-1";
1185
- const result = await this.runner.run("aws", [
1186
- "ecs",
1187
- "describe-services",
1188
- "--cluster",
1189
- context.appName,
1190
- "--services",
1191
- context.appName,
1192
- "--region",
1193
- region
1194
- ], context.projectRoot);
1201
+ const result = await this.runner.run(
1202
+ "aws",
1203
+ [
1204
+ "ecs",
1205
+ "describe-services",
1206
+ "--cluster",
1207
+ context.appName,
1208
+ "--services",
1209
+ context.appName,
1210
+ "--region",
1211
+ region
1212
+ ],
1213
+ context.projectRoot
1214
+ );
1195
1215
  if (result.exitCode !== 0) {
1196
1216
  return { state: "failed", message: result.stderr };
1197
1217
  }
@@ -1300,18 +1320,22 @@ var AwsLightsailAdapter = class {
1300
1320
  };
1301
1321
  const region = config.region ?? "us-east-1";
1302
1322
  const serviceName = sanitizeLightsailName(config.appName);
1303
- const createService = await this.runner.run("aws", [
1304
- "lightsail",
1305
- "create-container-service",
1306
- "--service-name",
1307
- serviceName,
1308
- "--power",
1309
- "nano",
1310
- "--scale",
1311
- "1",
1312
- "--region",
1313
- region
1314
- ], config.projectRoot);
1323
+ const createService = await this.runner.run(
1324
+ "aws",
1325
+ [
1326
+ "lightsail",
1327
+ "create-container-service",
1328
+ "--service-name",
1329
+ serviceName,
1330
+ "--power",
1331
+ "nano",
1332
+ "--scale",
1333
+ "1",
1334
+ "--region",
1335
+ region
1336
+ ],
1337
+ config.projectRoot
1338
+ );
1315
1339
  if (createService.exitCode !== 0 && !createService.stderr.includes("already exists")) {
1316
1340
  throw new Error(`Failed to create Lightsail container service: ${createService.stderr}`);
1317
1341
  }
@@ -1332,13 +1356,13 @@ var AwsLightsailAdapter = class {
1332
1356
  projectRoot: config.projectRoot,
1333
1357
  deployDirectory
1334
1358
  });
1335
- const client = await buildClient({
1359
+ const client = config.deployTarget === "sync-server" ? null : await buildClient({
1336
1360
  projectRoot: config.projectRoot,
1337
1361
  outDir: join8(deployDirectory, "dist"),
1338
1362
  mode: "production"
1339
1363
  });
1340
1364
  return {
1341
- clientDirectory: client.outDir,
1365
+ clientDirectory: client?.outDir ?? null,
1342
1366
  serverBundlePath: join8(deployDirectory, "server-bundled.js"),
1343
1367
  deployDirectory
1344
1368
  };
@@ -1349,30 +1373,31 @@ var AwsLightsailAdapter = class {
1349
1373
  const serviceName = sanitizeLightsailName(context.appName);
1350
1374
  const imageTag = `${serviceName}:latest`;
1351
1375
  this.logger.step("Building Docker image...");
1352
- const dockerBuild = await this.runner.run("docker", [
1353
- "build",
1354
- "--platform",
1355
- "linux/amd64",
1356
- "-t",
1357
- imageTag,
1358
- "."
1359
- ], artifacts.deployDirectory);
1376
+ const dockerBuild = await this.runner.run(
1377
+ "docker",
1378
+ ["build", "--platform", "linux/amd64", "-t", imageTag, "."],
1379
+ artifacts.deployDirectory
1380
+ );
1360
1381
  if (dockerBuild.exitCode !== 0) {
1361
1382
  throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
1362
1383
  }
1363
1384
  this.logger.step("Pushing image to Lightsail...");
1364
- const pushImage = await this.runner.run("aws", [
1365
- "lightsail",
1366
- "push-container-image",
1367
- "--service-name",
1368
- serviceName,
1369
- "--label",
1370
- "latest",
1371
- "--image",
1372
- imageTag,
1373
- "--region",
1374
- region
1375
- ], artifacts.deployDirectory);
1385
+ const pushImage = await this.runner.run(
1386
+ "aws",
1387
+ [
1388
+ "lightsail",
1389
+ "push-container-image",
1390
+ "--service-name",
1391
+ serviceName,
1392
+ "--label",
1393
+ "latest",
1394
+ "--image",
1395
+ imageTag,
1396
+ "--region",
1397
+ region
1398
+ ],
1399
+ artifacts.deployDirectory
1400
+ );
1376
1401
  if (pushImage.exitCode !== 0) {
1377
1402
  throw new Error(`Lightsail image push failed: ${pushImage.stderr}`);
1378
1403
  }
@@ -1403,29 +1428,30 @@ var AwsLightsailAdapter = class {
1403
1428
  unhealthyThreshold: 3
1404
1429
  }
1405
1430
  });
1406
- const createDeploy = await this.runner.run("aws", [
1407
- "lightsail",
1408
- "create-container-service-deployment",
1409
- "--service-name",
1410
- serviceName,
1411
- "--containers",
1412
- containers,
1413
- "--public-endpoint",
1414
- publicEndpoint,
1415
- "--region",
1416
- region
1417
- ], context.projectRoot);
1431
+ const createDeploy = await this.runner.run(
1432
+ "aws",
1433
+ [
1434
+ "lightsail",
1435
+ "create-container-service-deployment",
1436
+ "--service-name",
1437
+ serviceName,
1438
+ "--containers",
1439
+ containers,
1440
+ "--public-endpoint",
1441
+ publicEndpoint,
1442
+ "--region",
1443
+ region
1444
+ ],
1445
+ context.projectRoot
1446
+ );
1418
1447
  if (createDeploy.exitCode !== 0) {
1419
1448
  throw new Error(`Lightsail deployment failed: ${createDeploy.stderr}`);
1420
1449
  }
1421
- const serviceInfo = await this.runner.run("aws", [
1422
- "lightsail",
1423
- "get-container-services",
1424
- "--service-name",
1425
- serviceName,
1426
- "--region",
1427
- region
1428
- ], context.projectRoot);
1450
+ const serviceInfo = await this.runner.run(
1451
+ "aws",
1452
+ ["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
1453
+ context.projectRoot
1454
+ );
1429
1455
  const rawUrl = parseLightsailUrl(serviceInfo.stdout) ?? `https://${serviceName}.${region}.cs.amazonlightsail.com`;
1430
1456
  const serviceUrl = rawUrl.replace(/\/+$/, "");
1431
1457
  const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
@@ -1439,14 +1465,18 @@ var AwsLightsailAdapter = class {
1439
1465
  const context = this.requireContext();
1440
1466
  const region = context.region ?? "us-east-1";
1441
1467
  const serviceName = sanitizeLightsailName(context.appName);
1442
- const deployments = await this.runner.run("aws", [
1443
- "lightsail",
1444
- "get-container-service-deployments",
1445
- "--service-name",
1446
- serviceName,
1447
- "--region",
1448
- region
1449
- ], context.projectRoot);
1468
+ const deployments = await this.runner.run(
1469
+ "aws",
1470
+ [
1471
+ "lightsail",
1472
+ "get-container-service-deployments",
1473
+ "--service-name",
1474
+ serviceName,
1475
+ "--region",
1476
+ region
1477
+ ],
1478
+ context.projectRoot
1479
+ );
1450
1480
  if (deployments.exitCode !== 0) {
1451
1481
  throw new Error(`Lightsail rollback failed: ${deployments.stderr}`);
1452
1482
  }
@@ -1454,18 +1484,22 @@ var AwsLightsailAdapter = class {
1454
1484
  if (!previousDeployment) {
1455
1485
  throw new Error("No previous deployment found to rollback to.");
1456
1486
  }
1457
- const redeploy = await this.runner.run("aws", [
1458
- "lightsail",
1459
- "create-container-service-deployment",
1460
- "--service-name",
1461
- serviceName,
1462
- "--containers",
1463
- JSON.stringify(previousDeployment.containers),
1464
- "--public-endpoint",
1465
- JSON.stringify(previousDeployment.publicEndpoint),
1466
- "--region",
1467
- region
1468
- ], context.projectRoot);
1487
+ const redeploy = await this.runner.run(
1488
+ "aws",
1489
+ [
1490
+ "lightsail",
1491
+ "create-container-service-deployment",
1492
+ "--service-name",
1493
+ serviceName,
1494
+ "--containers",
1495
+ JSON.stringify(previousDeployment.containers),
1496
+ "--public-endpoint",
1497
+ JSON.stringify(previousDeployment.publicEndpoint),
1498
+ "--region",
1499
+ region
1500
+ ],
1501
+ context.projectRoot
1502
+ );
1469
1503
  if (redeploy.exitCode !== 0) {
1470
1504
  throw new Error(`Lightsail rollback deployment failed: ${redeploy.stderr}`);
1471
1505
  }
@@ -1512,14 +1546,11 @@ var AwsLightsailAdapter = class {
1512
1546
  const context = this.requireContext();
1513
1547
  const region = context.region ?? "us-east-1";
1514
1548
  const serviceName = sanitizeLightsailName(context.appName);
1515
- const result = await this.runner.run("aws", [
1516
- "lightsail",
1517
- "get-container-services",
1518
- "--service-name",
1519
- serviceName,
1520
- "--region",
1521
- region
1522
- ], context.projectRoot);
1549
+ const result = await this.runner.run(
1550
+ "aws",
1551
+ ["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
1552
+ context.projectRoot
1553
+ );
1523
1554
  if (result.exitCode !== 0) {
1524
1555
  return { state: "failed", message: result.stderr };
1525
1556
  }
@@ -1584,12 +1615,7 @@ ${error.message}` });
1584
1615
  });
1585
1616
  }
1586
1617
  };
1587
- var PASSTHROUGH_ENV_VARS = [
1588
- "DATABASE_URL",
1589
- "AUTH_SECRET",
1590
- "PUBLIC_URL",
1591
- "NODE_ENV"
1592
- ];
1618
+ var PASSTHROUGH_ENV_VARS = ["DATABASE_URL", "AUTH_SECRET", "PUBLIC_URL", "NODE_ENV"];
1593
1619
  function sanitizeLightsailName(name) {
1594
1620
  return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "").slice(0, 255) || "kora-app";
1595
1621
  }
@@ -1664,7 +1690,7 @@ var GENERATED_HEADER3 = "# Generated by kora deploy \u2014 do not edit manually"
1664
1690
  function generateDockerfile(options = {}) {
1665
1691
  const nodeVersion = options.nodeVersion ?? "20-alpine";
1666
1692
  const port = options.port ?? 3e3;
1667
- const clientDirectory = options.clientDirectory ?? "dist";
1693
+ const clientDirectory = options.clientDirectory === void 0 ? "dist" : options.clientDirectory;
1668
1694
  const serverBundleFile = options.serverBundleFile ?? "server-bundled.js";
1669
1695
  const hasNativeDeps = options.nativeDependencies && Object.keys(options.nativeDependencies).length > 0;
1670
1696
  const lines = [
@@ -1684,7 +1710,9 @@ function generateDockerfile(options = {}) {
1684
1710
  lines.push("RUN npm install --omit=dev");
1685
1711
  lines.push("");
1686
1712
  }
1687
- lines.push(`COPY ${clientDirectory} ./dist`);
1713
+ if (clientDirectory !== null) {
1714
+ lines.push(`COPY ${clientDirectory} ./dist`);
1715
+ }
1688
1716
  lines.push(`COPY ${serverBundleFile} ./server-bundled.js`);
1689
1717
  lines.push("");
1690
1718
  lines.push(`EXPOSE ${String(port)}`);
@@ -1700,7 +1728,8 @@ function generateDeployPackageJson(nativeDependencies) {
1700
1728
  type: "module",
1701
1729
  dependencies: nativeDependencies
1702
1730
  };
1703
- return JSON.stringify(pkg, null, 2) + "\n";
1731
+ return `${JSON.stringify(pkg, null, 2)}
1732
+ `;
1704
1733
  }
1705
1734
  function generateDockerIgnore() {
1706
1735
  return [
@@ -1855,7 +1884,8 @@ function readOptionalString(value, field) {
1855
1884
  }
1856
1885
 
1857
1886
  // src/commands/deploy/deploy-command.ts
1858
- import { basename } from "path";
1887
+ import { existsSync as existsSync2 } from "fs";
1888
+ import { basename, join as join11 } from "path";
1859
1889
  import { defineCommand } from "citty";
1860
1890
  var deployCommand = defineCommand({
1861
1891
  meta: {
@@ -2010,12 +2040,14 @@ var deployCommand = defineCommand({
2010
2040
  const region = resolveRegion(args.region, existingState?.region, confirmMode);
2011
2041
  const deployDirectory = resolveDeployDirectory(projectRoot);
2012
2042
  const environment = args.prod === true ? "production" : "preview";
2043
+ const deployTarget = detectDeployTarget(projectRoot);
2013
2044
  const config = {
2014
2045
  projectRoot,
2015
2046
  appName,
2016
2047
  region,
2017
2048
  environment,
2018
- confirm: confirmMode
2049
+ confirm: confirmMode,
2050
+ deployTarget
2019
2051
  };
2020
2052
  const adapter = createDeployAdapter(platform);
2021
2053
  configureAdapterContext(adapter, {
@@ -2027,14 +2059,18 @@ var deployCommand = defineCommand({
2027
2059
  logger.info(
2028
2060
  `Deploying to ${platform} (${appName}${region ? `, ${region}` : ""}, ${environment})`
2029
2061
  );
2062
+ if (deployTarget === "sync-server") {
2063
+ logger.step("Detected Tauri project. Deploying the sync server only.");
2064
+ }
2030
2065
  if (confirmMode) {
2031
2066
  logger.step("Running in --confirm mode (non-interactive, fail-fast).");
2032
2067
  }
2033
2068
  await writeDockerfileArtifact(deployDirectory, {
2069
+ clientDirectory: deployTarget === "sync-server" ? null : void 0,
2034
2070
  nativeDependencies: {
2035
2071
  "better-sqlite3": "^11.0.0",
2036
2072
  "drizzle-orm": "^0.45.2",
2037
- "postgres": "^3.4.0"
2073
+ postgres: "^3.4.0"
2038
2074
  }
2039
2075
  });
2040
2076
  await writeDockerIgnoreArtifact(deployDirectory);
@@ -2169,6 +2205,9 @@ function configureAdapterContext(adapter, context) {
2169
2205
  adapter.setContext(context);
2170
2206
  }
2171
2207
  }
2208
+ function detectDeployTarget(projectRoot) {
2209
+ return existsSync2(join11(projectRoot, "src-tauri")) ? "sync-server" : "full-stack";
2210
+ }
2172
2211
  function hasContextSetter(adapter) {
2173
2212
  return typeof adapter.setContext === "function";
2174
2213
  }
@@ -2299,4 +2338,4 @@ export {
2299
2338
  deployCommand,
2300
2339
  generateTypes
2301
2340
  };
2302
- //# sourceMappingURL=chunk-MIMLCXSX.js.map
2341
+ //# sourceMappingURL=chunk-SOTZIWIF.js.map