@korajs/cli 0.1.10 → 0.1.11

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 +52 -8
  2. package/dist/bin.cjs.map +1 -1
  3. package/dist/bin.js +2 -2
  4. package/dist/chunk-N36PFOSA.js +0 -0
  5. package/dist/{chunk-AUDUNRYA.js → chunk-SYOFLJLB.js} +33 -4
  6. package/dist/chunk-SYOFLJLB.js.map +1 -0
  7. package/dist/{chunk-ZVB4HAB3.js → chunk-VGOOQ56H.js} +22 -7
  8. package/dist/chunk-VGOOQ56H.js.map +1 -0
  9. package/dist/create.cjs +52 -8
  10. package/dist/create.cjs.map +1 -1
  11. package/dist/create.js +2 -2
  12. package/dist/index.cjs +21 -6
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +1 -1
  17. package/package.json +13 -13
  18. package/templates/react-basic/src/App.tsx +129 -31
  19. package/templates/react-basic/src/index.css +281 -0
  20. package/templates/react-basic/src/main.tsx +2 -0
  21. package/templates/react-sync/kora.config.ts +1 -1
  22. package/templates/react-sync/server.ts +13 -2
  23. package/templates/react-sync/src/App.tsx +132 -32
  24. package/templates/react-sync/src/index.css +292 -0
  25. package/templates/react-sync/src/main.tsx +2 -0
  26. package/templates/react-tailwind/index.html.hbs +12 -0
  27. package/templates/react-tailwind/kora.config.ts +13 -0
  28. package/templates/react-tailwind/package.json.hbs +31 -0
  29. package/templates/react-tailwind/src/App.tsx +212 -0
  30. package/templates/react-tailwind/src/index.css +7 -0
  31. package/templates/react-tailwind/src/kora-worker.ts +3 -0
  32. package/templates/react-tailwind/src/main.tsx +23 -0
  33. package/templates/react-tailwind/src/schema.ts +15 -0
  34. package/templates/react-tailwind/tsconfig.json +14 -0
  35. package/templates/react-tailwind/vite.config.ts +40 -0
  36. package/templates/react-tailwind-sync/index.html.hbs +12 -0
  37. package/templates/react-tailwind-sync/kora.config.ts +17 -0
  38. package/templates/react-tailwind-sync/package.json.hbs +33 -0
  39. package/templates/react-tailwind-sync/server.ts +22 -0
  40. package/templates/react-tailwind-sync/src/App.tsx +241 -0
  41. package/templates/react-tailwind-sync/src/index.css +7 -0
  42. package/templates/react-tailwind-sync/src/kora-worker.ts +3 -0
  43. package/templates/react-tailwind-sync/src/main.tsx +29 -0
  44. package/templates/react-tailwind-sync/src/schema.ts +15 -0
  45. package/templates/react-tailwind-sync/tsconfig.json +14 -0
  46. package/templates/react-tailwind-sync/vite.config.ts +40 -0
  47. package/dist/chunk-AUDUNRYA.js.map +0 -1
  48. package/dist/chunk-ZVB4HAB3.js.map +0 -1
package/dist/bin.cjs CHANGED
@@ -87,17 +87,32 @@ var DevServerError = class extends import_core.KoraError {
87
87
 
88
88
  // src/types.ts
89
89
  var PACKAGE_MANAGERS = ["pnpm", "npm", "yarn", "bun"];
90
- var TEMPLATES = ["react-basic", "react-sync"];
90
+ var TEMPLATES = [
91
+ "react-tailwind-sync",
92
+ "react-tailwind",
93
+ "react-sync",
94
+ "react-basic"
95
+ ];
91
96
  var TEMPLATE_INFO = [
92
97
  {
93
- name: "react-basic",
94
- label: "React (basic)",
95
- description: "Local-only React app with Kora \u2014 no sync server"
98
+ name: "react-tailwind-sync",
99
+ label: "React + Tailwind (with sync)",
100
+ description: "Polished dark-themed app with Tailwind CSS and sync server (Recommended)"
101
+ },
102
+ {
103
+ name: "react-tailwind",
104
+ label: "React + Tailwind (local-only)",
105
+ description: "Polished dark-themed app with Tailwind CSS \u2014 no sync server"
96
106
  },
97
107
  {
98
108
  name: "react-sync",
99
- label: "React (with sync)",
100
- description: "React app with Kora sync server included"
109
+ label: "React + CSS (with sync)",
110
+ description: "Clean CSS app with sync server included"
111
+ },
112
+ {
113
+ name: "react-basic",
114
+ label: "React + CSS (local-only)",
115
+ description: "Clean CSS app \u2014 no sync server"
101
116
  }
102
117
  ];
103
118
 
@@ -387,7 +402,7 @@ var createCommand = (0, import_citty.defineCommand)({
387
402
  },
388
403
  template: {
389
404
  type: "string",
390
- description: "Project template (react-basic, react-sync)"
405
+ description: "Project template (react-tailwind-sync, react-tailwind, react-sync, react-basic)"
391
406
  },
392
407
  pm: {
393
408
  type: "string",
@@ -397,12 +412,27 @@ var createCommand = (0, import_citty.defineCommand)({
397
412
  type: "boolean",
398
413
  description: "Skip installing dependencies",
399
414
  default: false
415
+ },
416
+ yes: {
417
+ type: "boolean",
418
+ alias: "y",
419
+ description: "Accept all defaults (react-tailwind-sync + detected package manager)",
420
+ default: false
421
+ },
422
+ tailwind: {
423
+ type: "boolean",
424
+ description: "Use Tailwind CSS (use --no-tailwind to skip)"
425
+ },
426
+ sync: {
427
+ type: "boolean",
428
+ description: "Include sync server (use --no-sync to skip)"
400
429
  }
401
430
  },
402
431
  async run({ args }) {
403
432
  const logger = createLogger();
404
433
  logger.banner();
405
- const projectName = args.name || await promptText("Project name", "my-kora-app");
434
+ const useDefaults = args.yes === true;
435
+ const projectName = args.name || (useDefaults ? "my-kora-app" : await promptText("Project name", "my-kora-app"));
406
436
  if (!projectName) {
407
437
  logger.error("Project name is required");
408
438
  process.exitCode = 1;
@@ -411,6 +441,10 @@ var createCommand = (0, import_citty.defineCommand)({
411
441
  let template;
412
442
  if (args.template && isValidTemplate(args.template)) {
413
443
  template = args.template;
444
+ } else if (useDefaults) {
445
+ template = "react-tailwind-sync";
446
+ } else if (args.tailwind !== void 0 || args.sync !== void 0) {
447
+ template = resolveTemplateFromFlags(args.tailwind, args.sync);
414
448
  } else {
415
449
  template = await promptSelect(
416
450
  "Select a template:",
@@ -420,6 +454,8 @@ var createCommand = (0, import_citty.defineCommand)({
420
454
  let pm;
421
455
  if (args.pm && isValidPackageManager(args.pm)) {
422
456
  pm = args.pm;
457
+ } else if (useDefaults) {
458
+ pm = detectPackageManager();
423
459
  } else {
424
460
  const detected = detectPackageManager();
425
461
  pm = await promptSelect(
@@ -465,6 +501,14 @@ function isValidTemplate(value) {
465
501
  function isValidPackageManager(value) {
466
502
  return PACKAGE_MANAGERS.includes(value);
467
503
  }
504
+ function resolveTemplateFromFlags(tailwind, sync) {
505
+ const useTailwind = tailwind !== false;
506
+ const useSync = sync !== false;
507
+ if (useTailwind && useSync) return "react-tailwind-sync";
508
+ if (useTailwind && !useSync) return "react-tailwind";
509
+ if (!useTailwind && useSync) return "react-sync";
510
+ return "react-basic";
511
+ }
468
512
  function resolveKoraVersion() {
469
513
  try {
470
514
  let dir = (0, import_node_path3.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));