@korajs/cli 0.3.2 → 0.4.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 (50) hide show
  1. package/dist/bin.cjs +385 -288
  2. package/dist/bin.cjs.map +1 -1
  3. package/dist/bin.js +25 -11
  4. package/dist/bin.js.map +1 -1
  5. package/dist/{chunk-KTSRAPSE.js → chunk-CMSX76KM.js} +108 -65
  6. package/dist/chunk-CMSX76KM.js.map +1 -0
  7. package/dist/{chunk-ZGYRDYXS.js → chunk-MVP5PDT4.js} +22 -4
  8. package/dist/chunk-MVP5PDT4.js.map +1 -0
  9. package/dist/{chunk-E7OCVRYL.js → chunk-YGVO4POI.js} +242 -215
  10. package/dist/chunk-YGVO4POI.js.map +1 -0
  11. package/dist/create.cjs +122 -66
  12. package/dist/create.cjs.map +1 -1
  13. package/dist/create.js +2 -2
  14. package/dist/index.cjs +348 -278
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +31 -26
  17. package/dist/index.d.ts +31 -26
  18. package/dist/index.js +2 -2
  19. package/package.json +2 -2
  20. package/templates/tauri-react/.env.example +7 -0
  21. package/templates/tauri-react/.github/workflows/release-desktop.yml +107 -0
  22. package/templates/tauri-react/README.md.hbs +148 -0
  23. package/templates/tauri-react/dev.ts +37 -0
  24. package/templates/tauri-react/index.html.hbs +16 -0
  25. package/templates/tauri-react/kora.config.ts +17 -0
  26. package/templates/tauri-react/package.json.hbs +44 -0
  27. package/templates/tauri-react/server.ts +23 -0
  28. package/templates/tauri-react/src/App.tsx +578 -0
  29. package/templates/tauri-react/src/AppShell.tsx +116 -0
  30. package/templates/tauri-react/src/SetupScreen.tsx +239 -0
  31. package/templates/tauri-react/src/main.tsx +9 -0
  32. package/templates/tauri-react/src/schema.ts +15 -0
  33. package/templates/tauri-react/src/sync-config.ts +103 -0
  34. package/templates/tauri-react/src/updater.ts +38 -0
  35. package/templates/tauri-react/src-tauri/Cargo.toml +19 -0
  36. package/templates/tauri-react/src-tauri/build.rs +3 -0
  37. package/templates/tauri-react/src-tauri/capabilities/default.json +12 -0
  38. package/templates/tauri-react/src-tauri/icons/128x128.png +0 -0
  39. package/templates/tauri-react/src-tauri/icons/128x128@2x.png +0 -0
  40. package/templates/tauri-react/src-tauri/icons/32x32.png +0 -0
  41. package/templates/tauri-react/src-tauri/icons/icon.icns +0 -0
  42. package/templates/tauri-react/src-tauri/icons/icon.ico +0 -0
  43. package/templates/tauri-react/src-tauri/src/lib.rs +8 -0
  44. package/templates/tauri-react/src-tauri/src/main.rs +6 -0
  45. package/templates/tauri-react/src-tauri/tauri.conf.json +44 -0
  46. package/templates/tauri-react/tsconfig.json +15 -0
  47. package/templates/tauri-react/vite.config.ts +15 -0
  48. package/dist/chunk-E7OCVRYL.js.map +0 -1
  49. package/dist/chunk-KTSRAPSE.js.map +0 -1
  50. package/dist/chunk-ZGYRDYXS.js.map +0 -1
package/dist/bin.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createCommand
4
- } from "./chunk-ZGYRDYXS.js";
4
+ } from "./chunk-MVP5PDT4.js";
5
5
  import {
6
6
  deployCommand,
7
7
  generateTypes
8
- } from "./chunk-E7OCVRYL.js";
8
+ } from "./chunk-YGVO4POI.js";
9
9
  import {
10
10
  DevServerError,
11
11
  InvalidProjectError,
@@ -16,7 +16,7 @@ import {
16
16
  hasTsxInstalled,
17
17
  promptConfirm,
18
18
  resolveProjectBinaryEntryPoint
19
- } from "./chunk-KTSRAPSE.js";
19
+ } from "./chunk-CMSX76KM.js";
20
20
 
21
21
  // src/bin.ts
22
22
  import { defineCommand as defineCommand4, runMain } from "citty";
@@ -236,7 +236,14 @@ var SchemaWatcher = class {
236
236
  this.watcher = null;
237
237
  }
238
238
  async regenerate() {
239
- const koraBinJs = join2(this.config.projectRoot, "node_modules", "@korajs", "cli", "dist", "bin.js");
239
+ const koraBinJs = join2(
240
+ this.config.projectRoot,
241
+ "node_modules",
242
+ "@korajs",
243
+ "cli",
244
+ "dist",
245
+ "bin.js"
246
+ );
240
247
  const hasTsx = await hasTsxInstalled(this.config.projectRoot);
241
248
  const command = process.execPath;
242
249
  const args = hasTsx ? ["--import", "tsx", koraBinJs, "generate", "types", "--schema", this.config.schemaPath] : [koraBinJs, "generate", "types", "--schema", this.config.schemaPath];
@@ -372,7 +379,9 @@ var devCommand = defineCommand({
372
379
  if (await fileExists(candidate)) {
373
380
  configuredSchemaPath = candidate;
374
381
  } else {
375
- logger.warn(`Configured schema file not found: ${candidate}. Falling back to auto-detection.`);
382
+ logger.warn(
383
+ `Configured schema file not found: ${candidate}. Falling back to auto-detection.`
384
+ );
376
385
  }
377
386
  }
378
387
  const schemaPath = configuredSchemaPath ?? await findSchemaFile(projectRoot);
@@ -526,7 +535,8 @@ function isPostgresEnvRequested(config) {
526
535
  const sync = config?.dev?.sync;
527
536
  if (typeof sync !== "object" || sync === null) return false;
528
537
  if (sync.store === "postgres") return true;
529
- if (typeof sync.store === "object" && sync.store !== null && sync.store.type === "postgres") return true;
538
+ if (typeof sync.store === "object" && sync.store !== null && sync.store.type === "postgres")
539
+ return true;
530
540
  return false;
531
541
  }
532
542
  var MANAGED_SYNC_BOOTSTRAP_SCRIPT = `
@@ -748,7 +758,8 @@ function isBreakingChange(change) {
748
758
  if (change.type === "field-changed") {
749
759
  if (change.before.kind !== change.after.kind) return true;
750
760
  if (change.before.itemKind !== change.after.itemKind) return true;
751
- if (serializeEnum(change.before.enumValues) !== serializeEnum(change.after.enumValues)) return true;
761
+ if (serializeEnum(change.before.enumValues) !== serializeEnum(change.after.enumValues))
762
+ return true;
752
763
  if (change.before.required !== change.after.required && change.after.required) return true;
753
764
  return false;
754
765
  }
@@ -1131,9 +1142,7 @@ async function runSqliteMigration(path, statements, migrationId, fromVersion, to
1131
1142
  async function loadSqliteDriver(projectRoot) {
1132
1143
  try {
1133
1144
  const { createRequire } = await import("module");
1134
- const requireFrom = createRequire(
1135
- projectRoot ? `${projectRoot}/package.json` : import.meta.url
1136
- );
1145
+ const requireFrom = createRequire(projectRoot ? `${projectRoot}/package.json` : import.meta.url);
1137
1146
  const Database = requireFrom("better-sqlite3");
1138
1147
  return {
1139
1148
  open(path) {
@@ -1411,7 +1420,12 @@ var migrateCommand = defineCommand3({
1411
1420
  return;
1412
1421
  }
1413
1422
  await mkdir2(outputDir, { recursive: true });
1414
- const migrationPath = await writeMigrationFile(outputDir, diff.fromVersion, diff.toVersion, generated);
1423
+ const migrationPath = await writeMigrationFile(
1424
+ outputDir,
1425
+ diff.fromVersion,
1426
+ diff.toVersion,
1427
+ generated
1428
+ );
1415
1429
  await writeSchemaSnapshot(snapshotFile, currentSchema);
1416
1430
  logger.blank();
1417
1431
  logger.success(`Generated migration: ${migrationPath}`);