@korajs/cli 0.3.2 → 0.3.4

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 (48) hide show
  1. package/dist/bin.cjs +120 -67
  2. package/dist/bin.cjs.map +1 -1
  3. package/dist/bin.js +3 -3
  4. package/dist/{chunk-KTSRAPSE.js → chunk-HNVCNPER.js} +105 -65
  5. package/dist/chunk-HNVCNPER.js.map +1 -0
  6. package/dist/{chunk-E7OCVRYL.js → chunk-MIMLCXSX.js} +2 -2
  7. package/dist/{chunk-ZGYRDYXS.js → chunk-ULTO5NFA.js} +22 -4
  8. package/dist/chunk-ULTO5NFA.js.map +1 -0
  9. package/dist/create.cjs +119 -66
  10. package/dist/create.cjs.map +1 -1
  11. package/dist/create.js +2 -2
  12. package/dist/index.cjs +105 -65
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +6 -1
  15. package/dist/index.d.ts +6 -1
  16. package/dist/index.js +2 -2
  17. package/package.json +1 -1
  18. package/templates/tauri-react/.env.example +7 -0
  19. package/templates/tauri-react/.github/workflows/release-desktop.yml +107 -0
  20. package/templates/tauri-react/README.md.hbs +148 -0
  21. package/templates/tauri-react/dev.ts +37 -0
  22. package/templates/tauri-react/index.html.hbs +16 -0
  23. package/templates/tauri-react/kora.config.ts +17 -0
  24. package/templates/tauri-react/package.json.hbs +44 -0
  25. package/templates/tauri-react/server.ts +23 -0
  26. package/templates/tauri-react/src/App.tsx +578 -0
  27. package/templates/tauri-react/src/AppShell.tsx +116 -0
  28. package/templates/tauri-react/src/SetupScreen.tsx +239 -0
  29. package/templates/tauri-react/src/main.tsx +9 -0
  30. package/templates/tauri-react/src/schema.ts +15 -0
  31. package/templates/tauri-react/src/sync-config.ts +103 -0
  32. package/templates/tauri-react/src/updater.ts +38 -0
  33. package/templates/tauri-react/src-tauri/Cargo.toml +19 -0
  34. package/templates/tauri-react/src-tauri/build.rs +3 -0
  35. package/templates/tauri-react/src-tauri/capabilities/default.json +12 -0
  36. package/templates/tauri-react/src-tauri/icons/128x128.png +0 -0
  37. package/templates/tauri-react/src-tauri/icons/128x128@2x.png +0 -0
  38. package/templates/tauri-react/src-tauri/icons/32x32.png +0 -0
  39. package/templates/tauri-react/src-tauri/icons/icon.icns +0 -0
  40. package/templates/tauri-react/src-tauri/icons/icon.ico +0 -0
  41. package/templates/tauri-react/src-tauri/src/lib.rs +8 -0
  42. package/templates/tauri-react/src-tauri/src/main.rs +6 -0
  43. package/templates/tauri-react/src-tauri/tauri.conf.json +44 -0
  44. package/templates/tauri-react/tsconfig.json +15 -0
  45. package/templates/tauri-react/vite.config.ts +15 -0
  46. package/dist/chunk-KTSRAPSE.js.map +0 -1
  47. package/dist/chunk-ZGYRDYXS.js.map +0 -1
  48. /package/dist/{chunk-E7OCVRYL.js.map → chunk-MIMLCXSX.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -91,7 +91,8 @@ var TEMPLATES = [
91
91
  "react-tailwind-sync",
92
92
  "react-tailwind",
93
93
  "react-sync",
94
- "react-basic"
94
+ "react-basic",
95
+ "tauri-react"
95
96
  ];
96
97
  var TEMPLATE_INFO = [
97
98
  {
@@ -113,6 +114,11 @@ var TEMPLATE_INFO = [
113
114
  name: "react-basic",
114
115
  label: "React + CSS (local-only)",
115
116
  description: "Clean CSS app \u2014 no sync server"
117
+ },
118
+ {
119
+ name: "tauri-react",
120
+ label: "Tauri Desktop (native SQLite)",
121
+ description: "Desktop app with native SQLite \u2014 no WASM, includes sync server"
116
122
  }
117
123
  ];
118
124
 
@@ -2731,12 +2737,16 @@ function validateProjectName(name) {
2731
2737
 
2732
2738
  // src/commands/create/options.ts
2733
2739
  function determineTemplateFromSelections(input) {
2740
+ if (input.platform === "desktop-tauri") return "tauri-react";
2734
2741
  const shouldSync = input.sync && input.db !== "none";
2735
2742
  if (input.tailwind && shouldSync) return "react-tailwind-sync";
2736
2743
  if (input.tailwind && !shouldSync) return "react-tailwind";
2737
2744
  if (!input.tailwind && shouldSync) return "react-sync";
2738
2745
  return "react-basic";
2739
2746
  }
2747
+ function isPlatformValue(value) {
2748
+ return value === "web" || value === "desktop-tauri";
2749
+ }
2740
2750
  function isFrameworkValue(value) {
2741
2751
  return value === "react" || value === "vue" || value === "svelte" || value === "solid";
2742
2752
  }
@@ -2753,6 +2763,7 @@ function isDatabaseProviderValue(value) {
2753
2763
  // src/prompts/preferences.ts
2754
2764
  var import_conf = __toESM(require("conf"), 1);
2755
2765
  var DEFAULT_PREFERENCES = {
2766
+ platform: "web",
2756
2767
  framework: "react",
2757
2768
  tailwind: true,
2758
2769
  sync: true,
@@ -2807,83 +2818,108 @@ async function resolveCreatePreferencesFlow(params) {
2807
2818
  usedStoredPreferences = true;
2808
2819
  }
2809
2820
  }
2810
- if (flags.framework !== void 0) {
2811
- if (!isFrameworkValue(flags.framework)) {
2821
+ if (flags.platform !== void 0) {
2822
+ if (!isPlatformValue(flags.platform)) {
2812
2823
  throw new Error(
2813
- `Invalid --framework value "${flags.framework}". Expected one of: react, vue, svelte, solid.`
2824
+ `Invalid --platform value "${flags.platform}". Expected one of: web, desktop-tauri.`
2814
2825
  );
2815
2826
  }
2816
- effective.framework = flags.framework;
2817
- } else if (!flags.useDefaults && !usedStoredPreferences) {
2818
- effective.framework = await prompts.select("UI framework:", [
2819
- { label: "React", value: "react" },
2820
- { label: "Vue (coming soon)", value: "vue", disabled: true },
2821
- { label: "Svelte (coming soon)", value: "svelte", disabled: true },
2822
- { label: "Solid (coming soon)", value: "solid", disabled: true }
2823
- ]);
2824
- }
2825
- if (flags.auth !== void 0) {
2826
- if (!isAuthValue(flags.auth)) {
2827
- throw new Error(
2828
- `Invalid --auth value "${flags.auth}". Expected one of: none, email-password, oauth.`
2829
- );
2830
- }
2831
- effective.auth = flags.auth;
2832
- } else if (!flags.useDefaults && !usedStoredPreferences) {
2833
- effective.auth = await prompts.select("Authentication:", [
2834
- { label: "None", value: "none" },
2835
- { label: "Email + Password (coming soon)", value: "email-password", disabled: true },
2836
- { label: "OAuth (coming soon)", value: "oauth", disabled: true }
2837
- ]);
2838
- }
2839
- if (flags.tailwind !== void 0) {
2840
- effective.tailwind = flags.tailwind;
2841
- } else if (!flags.useDefaults && !usedStoredPreferences) {
2842
- effective.tailwind = await prompts.confirm("Use Tailwind CSS?", true);
2843
- }
2844
- if (flags.sync !== void 0) {
2845
- effective.sync = flags.sync;
2846
- } else if (!flags.useDefaults && !usedStoredPreferences) {
2847
- effective.sync = await prompts.confirm("Enable multi-device sync?", true);
2848
- }
2849
- if (flags.db !== void 0) {
2850
- if (!isDatabaseValue(flags.db)) {
2851
- throw new Error(`Invalid --db value "${flags.db}". Expected one of: none, sqlite, postgres.`);
2852
- }
2853
- effective.db = flags.db;
2854
- } else if (!effective.sync) {
2855
- effective.db = "none";
2827
+ effective.platform = flags.platform;
2856
2828
  } else if (!flags.useDefaults && !usedStoredPreferences) {
2857
- effective.db = await prompts.select("Server-side database:", [
2858
- { label: "SQLite (zero-config)", value: "sqlite" },
2859
- { label: "PostgreSQL (production-scale)", value: "postgres" }
2829
+ effective.platform = await prompts.select("Platform:", [
2830
+ { label: "Web (browser)", value: "web" },
2831
+ { label: "Desktop (Tauri \u2014 native SQLite)", value: "desktop-tauri" }
2860
2832
  ]);
2861
2833
  }
2862
- if (effective.db !== "postgres") {
2834
+ const isTauri = effective.platform === "desktop-tauri";
2835
+ if (isTauri) {
2836
+ effective.framework = "react";
2837
+ effective.tailwind = false;
2838
+ effective.sync = true;
2839
+ effective.db = "sqlite";
2863
2840
  effective.dbProvider = "none";
2864
- } else if (flags.dbProvider !== void 0) {
2865
- if (!isDatabaseProviderValue(flags.dbProvider)) {
2866
- throw new Error(
2867
- `Invalid --db-provider value "${flags.dbProvider}". Expected one of: none, local, supabase, neon, railway, vercel-postgres, custom.`
2868
- );
2841
+ effective.auth = "none";
2842
+ } else {
2843
+ if (flags.framework !== void 0) {
2844
+ if (!isFrameworkValue(flags.framework)) {
2845
+ throw new Error(
2846
+ `Invalid --framework value "${flags.framework}". Expected one of: react, vue, svelte, solid.`
2847
+ );
2848
+ }
2849
+ effective.framework = flags.framework;
2850
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
2851
+ effective.framework = await prompts.select("UI framework:", [
2852
+ { label: "React", value: "react" },
2853
+ { label: "Vue (coming soon)", value: "vue", disabled: true },
2854
+ { label: "Svelte (coming soon)", value: "svelte", disabled: true },
2855
+ { label: "Solid (coming soon)", value: "solid", disabled: true }
2856
+ ]);
2857
+ }
2858
+ if (flags.auth !== void 0) {
2859
+ if (!isAuthValue(flags.auth)) {
2860
+ throw new Error(
2861
+ `Invalid --auth value "${flags.auth}". Expected one of: none, email-password, oauth.`
2862
+ );
2863
+ }
2864
+ effective.auth = flags.auth;
2865
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
2866
+ effective.auth = await prompts.select("Authentication:", [
2867
+ { label: "None", value: "none" },
2868
+ { label: "Email + Password (coming soon)", value: "email-password", disabled: true },
2869
+ { label: "OAuth (coming soon)", value: "oauth", disabled: true }
2870
+ ]);
2871
+ }
2872
+ if (flags.tailwind !== void 0) {
2873
+ effective.tailwind = flags.tailwind;
2874
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
2875
+ effective.tailwind = await prompts.confirm("Use Tailwind CSS?", true);
2876
+ }
2877
+ if (flags.sync !== void 0) {
2878
+ effective.sync = flags.sync;
2879
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
2880
+ effective.sync = await prompts.confirm("Enable multi-device sync?", true);
2881
+ }
2882
+ if (flags.db !== void 0) {
2883
+ if (!isDatabaseValue(flags.db)) {
2884
+ throw new Error(`Invalid --db value "${flags.db}". Expected one of: none, sqlite, postgres.`);
2885
+ }
2886
+ effective.db = flags.db;
2887
+ } else if (!effective.sync) {
2888
+ effective.db = "none";
2889
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
2890
+ effective.db = await prompts.select("Server-side database:", [
2891
+ { label: "SQLite (zero-config)", value: "sqlite" },
2892
+ { label: "PostgreSQL (production-scale)", value: "postgres" }
2893
+ ]);
2894
+ }
2895
+ if (effective.db !== "postgres") {
2896
+ effective.dbProvider = "none";
2897
+ } else if (flags.dbProvider !== void 0) {
2898
+ if (!isDatabaseProviderValue(flags.dbProvider)) {
2899
+ throw new Error(
2900
+ `Invalid --db-provider value "${flags.dbProvider}". Expected one of: none, local, supabase, neon, railway, vercel-postgres, custom.`
2901
+ );
2902
+ }
2903
+ effective.dbProvider = flags.dbProvider;
2904
+ } else if (!flags.useDefaults && !usedStoredPreferences) {
2905
+ effective.dbProvider = await prompts.select("Database provider:", [
2906
+ { label: "Local Postgres", value: "local" },
2907
+ { label: "Supabase", value: "supabase" },
2908
+ { label: "Neon", value: "neon" },
2909
+ { label: "Railway", value: "railway" },
2910
+ { label: "Vercel Postgres", value: "vercel-postgres" },
2911
+ { label: "Custom connection string", value: "custom" }
2912
+ ]);
2869
2913
  }
2870
- effective.dbProvider = flags.dbProvider;
2871
- } else if (!flags.useDefaults && !usedStoredPreferences) {
2872
- effective.dbProvider = await prompts.select("Database provider:", [
2873
- { label: "Local Postgres", value: "local" },
2874
- { label: "Supabase", value: "supabase" },
2875
- { label: "Neon", value: "neon" },
2876
- { label: "Railway", value: "railway" },
2877
- { label: "Vercel Postgres", value: "vercel-postgres" },
2878
- { label: "Custom connection string", value: "custom" }
2879
- ]);
2880
2914
  }
2881
2915
  const template = determineTemplateFromSelections({
2916
+ platform: effective.platform,
2882
2917
  tailwind: effective.tailwind,
2883
2918
  sync: effective.sync,
2884
2919
  db: effective.db
2885
2920
  });
2886
2921
  return {
2922
+ platform: effective.platform,
2887
2923
  framework: effective.framework,
2888
2924
  auth: effective.auth,
2889
2925
  db: effective.db,
@@ -2899,6 +2935,7 @@ function shouldSavePreferences(flags) {
2899
2935
  }
2900
2936
  function saveResolvedPreferences(store, resolution) {
2901
2937
  store.saveCreatePreferences({
2938
+ platform: resolution.platform,
2902
2939
  framework: resolution.framework,
2903
2940
  tailwind: resolution.tailwind,
2904
2941
  sync: resolution.sync,
@@ -2909,12 +2946,15 @@ function saveResolvedPreferences(store, resolution) {
2909
2946
  });
2910
2947
  }
2911
2948
  function hasExplicitPreferenceFlags(flags) {
2912
- return flags.framework !== void 0 || flags.auth !== void 0 || flags.db !== void 0 || flags.dbProvider !== void 0 || flags.tailwind !== void 0 || flags.sync !== void 0;
2949
+ return flags.platform !== void 0 || flags.framework !== void 0 || flags.auth !== void 0 || flags.db !== void 0 || flags.dbProvider !== void 0 || flags.tailwind !== void 0 || flags.sync !== void 0;
2913
2950
  }
2914
2951
  function promptSupportsRichOptions() {
2915
2952
  return typeof process !== "undefined" && process.stdin.isTTY && process.stdout.isTTY;
2916
2953
  }
2917
2954
  function formatStoredPreferenceLabel(preferences) {
2955
+ if (preferences.platform === "desktop-tauri") {
2956
+ return `Use previous settings (tauri-desktop + ${preferences.packageManager})`;
2957
+ }
2918
2958
  const syncLabel = preferences.sync ? `sync/${preferences.db}` : "local-only";
2919
2959
  const styleLabel = preferences.tailwind ? "tailwind" : "css";
2920
2960
  return `Use previous settings (${preferences.framework} + ${styleLabel} + ${syncLabel} + ${preferences.packageManager})`;
@@ -2992,7 +3032,7 @@ async function applySyncProviderPreset(options) {
2992
3032
  await (0, import_promises9.writeFile)(readmePath, readmeTemplate, "utf-8");
2993
3033
  }
2994
3034
  function isSyncTemplate(template) {
2995
- return template === "react-sync" || template === "react-tailwind-sync";
3035
+ return template === "react-sync" || template === "react-tailwind-sync" || template === "tauri-react";
2996
3036
  }
2997
3037
  function getProviderDisplayName(provider) {
2998
3038
  switch (provider) {