@korajs/cli 0.1.8 → 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.
- package/dist/bin.cjs +52 -8
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +2 -2
- package/dist/chunk-N36PFOSA.js +0 -0
- package/dist/{chunk-AUDUNRYA.js → chunk-SYOFLJLB.js} +33 -4
- package/dist/chunk-SYOFLJLB.js.map +1 -0
- package/dist/{chunk-ZVB4HAB3.js → chunk-VGOOQ56H.js} +22 -7
- package/dist/chunk-VGOOQ56H.js.map +1 -0
- package/dist/create.cjs +52 -8
- package/dist/create.cjs.map +1 -1
- package/dist/create.js +2 -2
- package/dist/index.cjs +21 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +13 -13
- package/templates/react-basic/src/App.tsx +129 -31
- package/templates/react-basic/src/index.css +281 -0
- package/templates/react-basic/src/main.tsx +2 -0
- package/templates/react-basic/vite.config.ts +31 -1
- package/templates/react-sync/kora.config.ts +1 -1
- package/templates/react-sync/server.ts +13 -2
- package/templates/react-sync/src/App.tsx +132 -32
- package/templates/react-sync/src/index.css +292 -0
- package/templates/react-sync/src/main.tsx +2 -0
- package/templates/react-sync/vite.config.ts +31 -1
- package/templates/react-tailwind/index.html.hbs +12 -0
- package/templates/react-tailwind/kora.config.ts +13 -0
- package/templates/react-tailwind/package.json.hbs +31 -0
- package/templates/react-tailwind/src/App.tsx +212 -0
- package/templates/react-tailwind/src/index.css +7 -0
- package/templates/react-tailwind/src/kora-worker.ts +3 -0
- package/templates/react-tailwind/src/main.tsx +23 -0
- package/templates/react-tailwind/src/schema.ts +15 -0
- package/templates/react-tailwind/tsconfig.json +14 -0
- package/templates/react-tailwind/vite.config.ts +40 -0
- package/templates/react-tailwind-sync/index.html.hbs +12 -0
- package/templates/react-tailwind-sync/kora.config.ts +17 -0
- package/templates/react-tailwind-sync/package.json.hbs +33 -0
- package/templates/react-tailwind-sync/server.ts +22 -0
- package/templates/react-tailwind-sync/src/App.tsx +241 -0
- package/templates/react-tailwind-sync/src/index.css +7 -0
- package/templates/react-tailwind-sync/src/kora-worker.ts +3 -0
- package/templates/react-tailwind-sync/src/main.tsx +29 -0
- package/templates/react-tailwind-sync/src/schema.ts +15 -0
- package/templates/react-tailwind-sync/tsconfig.json +14 -0
- package/templates/react-tailwind-sync/vite.config.ts +40 -0
- package/dist/chunk-AUDUNRYA.js.map +0 -1
- 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 = [
|
|
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-
|
|
94
|
-
label: "React (
|
|
95
|
-
description: "
|
|
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: "
|
|
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-
|
|
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
|
|
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));
|