@lytjs/cli 5.0.6 → 6.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 (43) hide show
  1. package/dist/create.cjs +522 -0
  2. package/dist/create.cjs.map +1 -0
  3. package/dist/create.d.mts +2 -0
  4. package/dist/create.d.ts +2 -0
  5. package/dist/create.mjs +520 -0
  6. package/dist/create.mjs.map +1 -0
  7. package/dist/index.cjs +1363 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.mts +188 -0
  10. package/dist/index.d.ts +188 -0
  11. package/dist/index.mjs +1219 -935
  12. package/dist/index.mjs.map +1 -0
  13. package/dist/lyt.cjs +1363 -0
  14. package/dist/lyt.cjs.map +1 -0
  15. package/dist/lyt.d.mts +1 -0
  16. package/dist/lyt.d.ts +1 -0
  17. package/dist/lyt.mjs +1342 -0
  18. package/dist/lyt.mjs.map +1 -0
  19. package/lyt-cli.js +3 -0
  20. package/package.json +34 -31
  21. package/README.md +0 -227
  22. package/dist/bin/cli.cjs +0 -1058
  23. package/dist/bin/cli.js +0 -2
  24. package/dist/bin/cli.mjs +0 -1058
  25. package/dist/index.js +0 -1058
  26. package/dist/types/bin/cli.d.ts +0 -8
  27. package/dist/types/bin/cli.d.ts.map +0 -1
  28. package/dist/types/build.d.ts +0 -30
  29. package/dist/types/build.d.ts.map +0 -1
  30. package/dist/types/create.d.ts +0 -19
  31. package/dist/types/create.d.ts.map +0 -1
  32. package/dist/types/dev.d.ts +0 -24
  33. package/dist/types/dev.d.ts.map +0 -1
  34. package/dist/types/generate.d.ts +0 -14
  35. package/dist/types/generate.d.ts.map +0 -1
  36. package/dist/types/hmr.d.ts +0 -55
  37. package/dist/types/hmr.d.ts.map +0 -1
  38. package/dist/types/index.d.ts +0 -20
  39. package/dist/types/index.d.ts.map +0 -1
  40. package/dist/types/scaffold.d.ts +0 -67
  41. package/dist/types/scaffold.d.ts.map +0 -1
  42. package/dist/types/utils.d.ts +0 -92
  43. package/dist/types/utils.d.ts.map +0 -1
package/dist/lyt.mjs ADDED
@@ -0,0 +1,1342 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync, mkdirSync, writeFileSync, readdirSync } from 'fs';
3
+ import { join, resolve, dirname } from 'path';
4
+ import { execSync, spawn } from 'child_process';
5
+
6
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
7
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
8
+ }) : x)(function(x) {
9
+ if (typeof require !== "undefined") return require.apply(this, arguments);
10
+ throw Error('Dynamic require of "' + x + '" is not supported');
11
+ });
12
+
13
+ // src/utils/logger.ts
14
+ var colors = {
15
+ reset: "\x1B[0m",
16
+ bright: "\x1B[1m",
17
+ dim: "\x1B[2m",
18
+ red: "\x1B[31m",
19
+ green: "\x1B[32m",
20
+ yellow: "\x1B[33m",
21
+ blue: "\x1B[34m",
22
+ cyan: "\x1B[36m"
23
+ };
24
+ function colorize(text, color) {
25
+ if (!isColorSupported()) return text;
26
+ return `${colors[color]}${text}${colors.reset}`;
27
+ }
28
+ var logger = {
29
+ info(message) {
30
+ console.log(colorize("\u2139 ", "blue") + message);
31
+ },
32
+ success(message) {
33
+ console.log(colorize("\u2714 ", "green") + message);
34
+ },
35
+ warning(message) {
36
+ console.log(colorize("\u26A0 ", "yellow") + message);
37
+ },
38
+ error(message) {
39
+ console.error(colorize("\u2716 ", "red") + message);
40
+ },
41
+ dim(message) {
42
+ console.log(colorize(message, "dim"));
43
+ },
44
+ bold(message) {
45
+ return colorize(message, "bright");
46
+ }
47
+ };
48
+ function isColorSupported() {
49
+ return process.stdout.isTTY && process.env.NO_COLOR !== "1";
50
+ }
51
+ function ensureDir(dir) {
52
+ if (!existsSync(dir)) {
53
+ mkdirSync(dir, { recursive: true });
54
+ }
55
+ }
56
+ function writeFile(filePath, content) {
57
+ ensureDir(dirname(filePath));
58
+ writeFileSync(filePath, content, "utf-8");
59
+ }
60
+ function readFile(filePath) {
61
+ return readFileSync(filePath, "utf-8");
62
+ }
63
+ function exists(path) {
64
+ return existsSync(path);
65
+ }
66
+ function isEmptyDir(dir) {
67
+ if (!existsSync(dir)) return true;
68
+ const files = readdirSync(dir);
69
+ return files.length === 0;
70
+ }
71
+ function detectPackageManager(cwd = process.cwd()) {
72
+ if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
73
+ if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
74
+ if (existsSync(join(cwd, "package-lock.json"))) return "npm";
75
+ try {
76
+ execSync("pnpm --version", { stdio: "ignore" });
77
+ return "pnpm";
78
+ } catch {
79
+ return "npm";
80
+ }
81
+ }
82
+ function getInstallCommand(pm) {
83
+ switch (pm) {
84
+ case "pnpm":
85
+ return "pnpm install";
86
+ case "yarn":
87
+ return "yarn";
88
+ case "npm":
89
+ return "npm install";
90
+ }
91
+ }
92
+ function getRunCommand(pm, script) {
93
+ switch (pm) {
94
+ case "pnpm":
95
+ return `pnpm run ${script}`;
96
+ case "yarn":
97
+ return `yarn ${script}`;
98
+ case "npm":
99
+ return `npm run ${script}`;
100
+ }
101
+ }
102
+ function getAddCommand(pm, dep, dev2 = false) {
103
+ const devFlag = dev2 ? " -D" : "";
104
+ switch (pm) {
105
+ case "pnpm":
106
+ return `pnpm add${devFlag} ${dep}`;
107
+ case "yarn":
108
+ return `yarn add${devFlag} ${dep}`;
109
+ case "npm":
110
+ return `npm install${devFlag} ${dep}`;
111
+ }
112
+ }
113
+ var TEMPLATES = {
114
+ default: "Default template with TypeScript and Vite",
115
+ minimal: "Minimal template without extra dependencies",
116
+ ssr: "SSR-enabled template",
117
+ router: "Template with Router integration",
118
+ store: "Template with Store integration",
119
+ full: "Full-featured template with Router, Store, and UI components"
120
+ };
121
+ async function create(projectName, options = {}) {
122
+ if (!projectName) {
123
+ logger.error("Please provide a project name.");
124
+ logger.info("Usage: lyt create <project-name>");
125
+ process.exit(1);
126
+ }
127
+ const targetDir = resolve(process.cwd(), projectName);
128
+ if (exists(targetDir) && !isEmptyDir(targetDir) && !options.force) {
129
+ logger.error(`Directory "${projectName}" already exists and is not empty.`);
130
+ logger.info("Use --force to overwrite.");
131
+ process.exit(1);
132
+ }
133
+ logger.info(`Creating a new LytJS project in ${targetDir}...`);
134
+ ensureDir(targetDir);
135
+ generateProjectFiles(targetDir, projectName, options.template || "default");
136
+ logger.info("Installing dependencies...");
137
+ const pm = detectPackageManager();
138
+ try {
139
+ execSync(getInstallCommand(pm), { cwd: targetDir, stdio: "inherit" });
140
+ logger.success("Dependencies installed successfully!");
141
+ } catch (_error) {
142
+ logger.warning("Failed to install dependencies automatically.");
143
+ logger.info(`Please run "${getInstallCommand(pm)}" manually.`);
144
+ }
145
+ logger.success(`Project "${projectName}" created successfully!`);
146
+ logger.info("");
147
+ logger.bold("Next steps:");
148
+ logger.info(` cd ${projectName}`);
149
+ logger.info(` ${pm === "npm" ? "npm run" : pm} dev`);
150
+ }
151
+ function generateProjectFiles(targetDir, projectName, template) {
152
+ const isMinimal = template === "minimal";
153
+ const isSsr = template === "ssr";
154
+ const isRouter = template === "router" || template === "full";
155
+ const isStore = template === "store" || template === "full";
156
+ const isFull = template === "full";
157
+ const packageJson = {
158
+ name: projectName,
159
+ version: "0.0.0",
160
+ type: "module",
161
+ scripts: {
162
+ dev: "vite",
163
+ build: "vite build",
164
+ preview: "vite preview"
165
+ },
166
+ dependencies: {
167
+ "@lytjs/core": "^6.0.0"
168
+ },
169
+ devDependencies: {
170
+ "@lytjs/plugin-vite": "^6.0.0",
171
+ "vite": "^5.0.0"
172
+ }
173
+ };
174
+ if (!isMinimal) {
175
+ packageJson.scripts.test = "vitest";
176
+ packageJson.devDependencies.vitest = "^1.0.0";
177
+ }
178
+ if (isSsr) {
179
+ packageJson.dependencies["@lytjs/server"] = "^6.0.0";
180
+ packageJson.scripts["build:client"] = "vite build --ssrManifest";
181
+ packageJson.scripts["build:server"] = "vite build --ssr src/entry-server.ts";
182
+ packageJson.scripts["build"] = "npm run build:client && npm run build:server";
183
+ packageJson.scripts["preview"] = "node server";
184
+ }
185
+ if (isRouter) {
186
+ packageJson.dependencies["@lytjs/router"] = "^1.0.0";
187
+ }
188
+ if (isStore) {
189
+ packageJson.dependencies["@lytjs/store"] = "^1.0.0";
190
+ }
191
+ if (isFull) {
192
+ packageJson.dependencies["@lytjs/ui"] = "^0.4.0";
193
+ }
194
+ writeFile(join(targetDir, "package.json"), JSON.stringify(packageJson, null, 2));
195
+ let viteConfig;
196
+ if (isSsr) {
197
+ viteConfig = `import { defineConfig } from 'vite';
198
+ import lytjs from '@lytjs/plugin-vite';
199
+
200
+ export default defineConfig({
201
+ plugins: [lytjs()],
202
+ build: {
203
+ ssrManifest: true,
204
+ },
205
+ });
206
+ `;
207
+ } else {
208
+ viteConfig = `import { defineConfig } from 'vite';
209
+ import lytjs from '@lytjs/plugin-vite';
210
+
211
+ export default defineConfig({
212
+ plugins: [lytjs()],
213
+ });
214
+ `;
215
+ }
216
+ writeFile(join(targetDir, "vite.config.ts"), viteConfig);
217
+ const indexHtml = `<!DOCTYPE html>
218
+ <html lang="en">
219
+ <head>
220
+ <meta charset="UTF-8" />
221
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
222
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
223
+ <title>${projectName}</title>
224
+ </head>
225
+ <body>
226
+ <div id="app"></div>
227
+ <script type="module" src="/src/main.ts"></script>
228
+ </body>
229
+ </html>
230
+ `;
231
+ writeFile(join(targetDir, "index.html"), indexHtml);
232
+ let mainTs;
233
+ if (isSsr) {
234
+ mainTs = `import { createApp } from '@lytjs/core';
235
+ import App from './App.lyt';
236
+ import { createSSRApp } from '@lytjs/server';
237
+ ${isRouter ? "import { createRouter, createWebHistory } from '@lytjs/router';" : ""}
238
+ ${isStore ? "import { createPinia } from '@lytjs/store';" : ""}
239
+
240
+ const app = createSSRApp(App);
241
+ ${isStore ? "app.use(createPinia());" : ""}
242
+ ${isRouter ? `
243
+ const router = createRouter({
244
+ history: createWebHistory(),
245
+ routes: [
246
+ { path: '/', component: () => import('./pages/Home.lyt') },
247
+ { path: '/about', component: () => import('./pages/About.lyt') },
248
+ ],
249
+ });
250
+ app.use(router);
251
+ ` : ""}
252
+ app.mount('#app');
253
+ `;
254
+ } else if (isRouter || isStore) {
255
+ mainTs = `import { createApp } from '@lytjs/core';
256
+ import App from './App.lyt';
257
+ ${isRouter ? "import { createRouter, createWebHistory } from '@lytjs/router';" : ""}
258
+ ${isStore ? "import { createPinia } from '@lytjs/store';" : ""}
259
+
260
+ const app = createApp(App);
261
+ ${isStore ? "app.use(createPinia());" : ""}
262
+ ${isRouter ? `
263
+ const router = createRouter({
264
+ history: createWebHistory(),
265
+ routes: [
266
+ { path: '/', component: () => import('./pages/Home.lyt') },
267
+ { path: '/about', component: () => import('./pages/About.lyt') },
268
+ ],
269
+ });
270
+ app.use(router);
271
+ ` : ""}
272
+ app.mount('#app');
273
+ `;
274
+ } else {
275
+ mainTs = `import { createApp } from '@lytjs/core';
276
+ import App from './App.lyt';
277
+
278
+ createApp(App).mount('#app');
279
+ `;
280
+ }
281
+ writeFile(join(targetDir, "src/main.ts"), mainTs);
282
+ let appLyt;
283
+ if (isMinimal) {
284
+ appLyt = `<template>
285
+ <div class="app">
286
+ <h1>{{ title }}</h1>
287
+ </div>
288
+ </template>
289
+
290
+ <script setup>
291
+ const title = 'Hello LytJS!';
292
+ </script>
293
+
294
+ <style scoped>
295
+ .app {
296
+ text-align: center;
297
+ }
298
+ </style>
299
+ `;
300
+ } else if (isRouter) {
301
+ appLyt = `<template>
302
+ <div class="app">
303
+ <nav class="nav">
304
+ <router-link to="/">Home</router-link>
305
+ <router-link to="/about">About</router-link>
306
+ </nav>
307
+ <router-view />
308
+ </div>
309
+ </template>
310
+
311
+ <script setup lang="ts">
312
+ import { RouterLink, RouterView } from '@lytjs/router';
313
+ </script>
314
+
315
+ <style scoped>
316
+ .app {
317
+ text-align: center;
318
+ padding: 2rem;
319
+ }
320
+
321
+ .nav {
322
+ margin-bottom: 2rem;
323
+ }
324
+
325
+ .nav a {
326
+ margin: 0 1rem;
327
+ color: #42b883;
328
+ text-decoration: none;
329
+ }
330
+
331
+ .nav a:hover {
332
+ text-decoration: underline;
333
+ }
334
+ </style>
335
+ `;
336
+ } else {
337
+ appLyt = `<template>
338
+ <div class="app">
339
+ <h1>{{ title }}</h1>
340
+ <p>Welcome to your LytJS app!</p>
341
+ </div>
342
+ </template>
343
+
344
+ <script setup>
345
+ const title = 'Hello LytJS!';
346
+ </script>
347
+
348
+ <style scoped>
349
+ .app {
350
+ text-align: center;
351
+ padding: 2rem;
352
+ }
353
+
354
+ h1 {
355
+ color: #42b883;
356
+ }
357
+ </style>
358
+ `;
359
+ }
360
+ writeFile(join(targetDir, "src/App.lyt"), appLyt);
361
+ if (isRouter) {
362
+ const homePage = `<template>
363
+ <div class="home">
364
+ <h1>Home</h1>
365
+ ${isStore ? `
366
+ <p>Count: {{ count }}</p>
367
+ <button @click="increment">Increment</button>
368
+ <button @click="decrement">Decrement</button>
369
+ ` : ""}
370
+ <p>Welcome to the Home page!</p>
371
+ </div>
372
+ </template>
373
+
374
+ <script setup lang="ts">
375
+ ${isStore ? `import { useCounterStore } from '../stores/counter';
376
+ const counterStore = useCounterStore();
377
+ const { count, increment, decrement } = counterStore;
378
+ ` : ""}
379
+ </script>
380
+
381
+ <style scoped>
382
+ .home {
383
+ padding: 1rem;
384
+ }
385
+ </style>
386
+ `;
387
+ ensureDir(join(targetDir, "src", "pages"));
388
+ writeFile(join(targetDir, "src", "pages", "Home.lyt"), homePage);
389
+ const aboutPage = `<template>
390
+ <div class="about">
391
+ <h1>About</h1>
392
+ <p>This is the About page!</p>
393
+ </div>
394
+ </template>
395
+
396
+ <script setup lang="ts">
397
+ </script>
398
+
399
+ <style scoped>
400
+ .about {
401
+ padding: 1rem;
402
+ }
403
+ </style>
404
+ `;
405
+ writeFile(join(targetDir, "src", "pages", "About.lyt"), aboutPage);
406
+ }
407
+ if (isStore) {
408
+ const counterStore = `import { defineStore } from '@lytjs/store';
409
+ import { signal, computed } from '@lytjs/reactivity';
410
+
411
+ export const useCounterStore = defineStore('counter', () => {
412
+ // State
413
+ const count = signal(0);
414
+
415
+ // Getters
416
+ const doubleCount = computed(() => count.value * 2);
417
+
418
+ // Actions
419
+ function increment() {
420
+ count.value++;
421
+ }
422
+
423
+ function decrement() {
424
+ count.value--;
425
+ }
426
+
427
+ function reset() {
428
+ count.value = 0;
429
+ }
430
+
431
+ return {
432
+ count,
433
+ doubleCount,
434
+ increment,
435
+ decrement,
436
+ reset,
437
+ };
438
+ });
439
+ `;
440
+ ensureDir(join(targetDir, "src", "stores"));
441
+ writeFile(join(targetDir, "src", "stores", "counter.ts"), counterStore);
442
+ }
443
+ if (isSsr) {
444
+ const entryServer = `import { createSSRApp } from '@lytjs/core';
445
+ import App from './App.lyt';
446
+
447
+ export async function render(url: string) {
448
+ const app = createSSRApp(App);
449
+ return app;
450
+ }
451
+ `;
452
+ writeFile(join(targetDir, "src/entry-server.ts"), entryServer);
453
+ const entryClient = `import { createApp } from '@lytjs/core';
454
+ import App from './App.lyt';
455
+
456
+ const app = createApp(App);
457
+ app.mount('#app');
458
+ `;
459
+ writeFile(join(targetDir, "src/entry-client.ts"), entryClient);
460
+ const serverTs = `/**
461
+ * LytJS SSR Server
462
+ *
463
+ * A minimal SSR server for development and production.
464
+ */
465
+
466
+ import fs from 'fs';
467
+ import path from 'path';
468
+ import { fileURLToPath } from 'url';
469
+
470
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
471
+ const isProduction = process.env.NODE_ENV === 'production';
472
+
473
+ async function createServer() {
474
+ let resolve: any;
475
+ let vite: any;
476
+
477
+ if (!isProduction) {
478
+ const { createServer: createViteServer } = await import('vite');
479
+ vite = await createViteServer({
480
+ server: { middlewareMode: true },
481
+ appType: 'custom',
482
+ });
483
+ resolve = (id: string) => vite.resolveUrl(id);
484
+ } else {
485
+ resolve = (id: string) => id;
486
+ }
487
+
488
+ // TODO: Set up express/polka server and SSR rendering
489
+ console.log('LytJS SSR server starting...');
490
+ }
491
+
492
+ createServer();
493
+ `;
494
+ writeFile(join(targetDir, "server.ts"), serverTs);
495
+ }
496
+ const tsConfig = {
497
+ compilerOptions: {
498
+ target: "ES2020",
499
+ useDefineForClassFields: true,
500
+ module: "ESNext",
501
+ lib: ["ES2020", "DOM", "DOM.Iterable"],
502
+ skipLibCheck: true,
503
+ moduleResolution: "bundler",
504
+ allowImportingTsExtensions: true,
505
+ resolveJsonModule: true,
506
+ isolatedModules: true,
507
+ noEmit: true,
508
+ strict: true,
509
+ noUnusedLocals: true,
510
+ noUnusedParameters: true,
511
+ noFallthroughCasesInSwitch: true
512
+ },
513
+ include: ["src/**/*.ts", "src/**/*.lyt"],
514
+ references: [{ path: "./tsconfig.node.json" }]
515
+ };
516
+ writeFile(join(targetDir, "tsconfig.json"), JSON.stringify(tsConfig, null, 2));
517
+ const tsConfigNode = {
518
+ compilerOptions: {
519
+ composite: true,
520
+ skipLibCheck: true,
521
+ module: "ESNext",
522
+ moduleResolution: "bundler",
523
+ allowSyntheticDefaultImports: true
524
+ },
525
+ include: ["vite.config.ts"]
526
+ };
527
+ writeFile(join(targetDir, "tsconfig.node.json"), JSON.stringify(tsConfigNode, null, 2));
528
+ const gitignore = `# Logs
529
+ logs
530
+ *.log
531
+ npm-debug.log*
532
+ yarn-debug.log*
533
+ yarn-error.log*
534
+ pnpm-debug.log*
535
+ lerna-debug.log*
536
+
537
+ node_modules
538
+ dist
539
+ dist-ssr
540
+ *.local
541
+
542
+ # Editor directories and files
543
+ .vscode/*
544
+ !.vscode/extensions.json
545
+ .idea
546
+ .DS_Store
547
+ *.suo
548
+ *.ntvs*
549
+ *.njsproj
550
+ *.sln
551
+ *.sw?
552
+ `;
553
+ writeFile(join(targetDir, ".gitignore"), gitignore);
554
+ }
555
+ function listTemplates() {
556
+ logger.bold("Available templates:");
557
+ for (const [name, description] of Object.entries(TEMPLATES)) {
558
+ logger.info(` ${name.padEnd(10)} - ${description}`);
559
+ }
560
+ }
561
+ async function dev(options = {}) {
562
+ if (!exists(join(process.cwd(), "package.json"))) {
563
+ logger.error("No package.json found. Are you in a LytJS project directory?");
564
+ process.exit(1);
565
+ }
566
+ const pm = detectPackageManager();
567
+ const runCmd = getRunCommand(pm, "dev");
568
+ logger.info(`Starting development server with ${pm}...`);
569
+ const devArgs = [];
570
+ if (options.port) devArgs.push("--port", String(options.port));
571
+ if (options.host) devArgs.push("--host", options.host);
572
+ if (options.open) devArgs.push("--open");
573
+ const cmdParts = runCmd.split(" ");
574
+ const cmd = cmdParts[0] ?? "pnpm";
575
+ const cmdArgs = [...cmdParts.slice(1), ...devArgs];
576
+ const child = spawn(cmd, cmdArgs, {
577
+ stdio: "inherit",
578
+ shell: true
579
+ });
580
+ child.on("error", (error) => {
581
+ logger.error(`Failed to start dev server: ${error.message}`);
582
+ process.exit(1);
583
+ });
584
+ child.on("exit", (code) => {
585
+ process.exit(code || 0);
586
+ });
587
+ }
588
+ async function build(options = {}) {
589
+ if (!exists(join(process.cwd(), "package.json"))) {
590
+ logger.error("No package.json found. Are you in a LytJS project directory?");
591
+ process.exit(1);
592
+ }
593
+ const pm = detectPackageManager();
594
+ logger.info("Building for production...");
595
+ const args = ["vite", "build"];
596
+ if (options.outDir) args.push("--outDir", options.outDir);
597
+ if (options.ssr) args.push("--ssr");
598
+ if (options.minify === false) args.push("--minify", "false");
599
+ const child = spawn(pm === "npm" ? "npx" : pm, args, {
600
+ stdio: "inherit",
601
+ shell: true
602
+ });
603
+ child.on("error", (error) => {
604
+ logger.error(`Build failed: ${error.message}`);
605
+ process.exit(1);
606
+ });
607
+ child.on("exit", (code) => {
608
+ if (code === 0) {
609
+ logger.success("Build completed successfully!");
610
+ } else {
611
+ logger.error(`Build failed with exit code ${code}`);
612
+ }
613
+ process.exit(code || 0);
614
+ });
615
+ }
616
+ async function test(options = {}) {
617
+ if (!exists(join(process.cwd(), "package.json"))) {
618
+ logger.error("No package.json found. Are you in a LytJS project directory?");
619
+ process.exit(1);
620
+ }
621
+ const pm = detectPackageManager();
622
+ logger.info("Running tests...");
623
+ const args = ["vitest"];
624
+ if (options.watch === false) args.push("run");
625
+ if (options.coverage) args.push("--coverage");
626
+ if (options.grep) args.push("--grep", options.grep);
627
+ const child = spawn(pm === "npm" ? "npx" : pm, args, {
628
+ stdio: "inherit",
629
+ shell: true
630
+ });
631
+ child.on("error", (error) => {
632
+ logger.error(`Tests failed: ${error.message}`);
633
+ process.exit(1);
634
+ });
635
+ child.on("exit", (code) => {
636
+ process.exit(code || 0);
637
+ });
638
+ }
639
+ var TEMPLATES2 = {
640
+ component(name, basePath) {
641
+ const filePath = join(basePath, `${name}.lyt`);
642
+ return [{
643
+ filePath,
644
+ content: `<template>
645
+ <div class="${name}">
646
+ <slot />
647
+ </div>
648
+ </template>
649
+
650
+ <script setup lang="ts">
651
+ defineProps<{
652
+ /** Component props */
653
+ }>();
654
+
655
+ defineEmits<{
656
+ /** Component events */
657
+ }>();
658
+ </script>
659
+
660
+ <style scoped>
661
+ .${name} {
662
+ /* styles */
663
+ }
664
+ </style>
665
+ `
666
+ }];
667
+ },
668
+ page(name, basePath) {
669
+ const filePath = join(basePath, `${name}.lyt`);
670
+ return [{
671
+ filePath,
672
+ content: `<template>
673
+ <div class="page-${name}">
674
+ <h1>${toPascalCase(name)}</h1>
675
+ </div>
676
+ </template>
677
+
678
+ <script setup lang="ts">
679
+ // Page logic here
680
+ </script>
681
+
682
+ <style scoped>
683
+ .page-${name} {
684
+ padding: 1rem;
685
+ }
686
+ </style>
687
+ `
688
+ }];
689
+ },
690
+ store(name, basePath) {
691
+ const filePath = join(basePath, `${name}.ts`);
692
+ return [{
693
+ filePath,
694
+ content: `import { defineStore } from '@lytjs/store';
695
+ import { signal, computed } from '@lytjs/reactivity';
696
+
697
+ export const use${toPascalCase(name)}Store = defineStore('${name}', () => {
698
+ // State
699
+ const count = signal(0);
700
+
701
+ // Getters
702
+ const doubleCount = computed(() => count.value * 2);
703
+
704
+ // Actions
705
+ function increment() {
706
+ count.value++;
707
+ }
708
+
709
+ function decrement() {
710
+ count.value--;
711
+ }
712
+
713
+ function reset() {
714
+ count.value = 0;
715
+ }
716
+
717
+ return {
718
+ count,
719
+ doubleCount,
720
+ increment,
721
+ decrement,
722
+ reset,
723
+ };
724
+ });
725
+ `
726
+ }];
727
+ }
728
+ };
729
+ function toPascalCase(str) {
730
+ return str.split(/[-_]/).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
731
+ }
732
+ function resolveTargetDir(type) {
733
+ const cwd = process.cwd();
734
+ switch (type) {
735
+ case "component":
736
+ return join(cwd, "src", "components");
737
+ case "page":
738
+ return join(cwd, "src", "pages");
739
+ case "store":
740
+ return join(cwd, "src", "stores");
741
+ }
742
+ }
743
+ async function add(type, name, options = {}) {
744
+ const targetDir = resolveTargetDir(type);
745
+ const fullPath = resolve(targetDir);
746
+ if (!exists(join(process.cwd(), "package.json"))) {
747
+ logger.error("No package.json found. Are you in a LytJS project directory?");
748
+ process.exit(1);
749
+ }
750
+ const template = TEMPLATES2[type];
751
+ if (!template) {
752
+ logger.error(`Unknown type: ${type}. Supported types: component, page, store`);
753
+ process.exit(1);
754
+ }
755
+ const files = template(name, fullPath);
756
+ for (const file of files) {
757
+ if (exists(file.filePath) && !options.force) {
758
+ logger.warning(`File already exists: ${file.filePath}`);
759
+ logger.info("Use --force to overwrite.");
760
+ continue;
761
+ }
762
+ ensureDir(resolve(file.filePath, ".."));
763
+ writeFile(file.filePath, file.content);
764
+ logger.success(`Created ${type}: ${file.filePath}`);
765
+ }
766
+ }
767
+ var PLUGIN_TEMPLATES = {
768
+ default: "Default plugin template with TypeScript",
769
+ minimal: "Minimal plugin without extra dependencies",
770
+ withConfig: "Plugin template with configuration schema"
771
+ };
772
+ function getTemplateContent(template, pluginName) {
773
+ const packageName = `@lytjs/plugin-${pluginName}`;
774
+ const files = {};
775
+ files["package.json"] = JSON.stringify({
776
+ name: packageName,
777
+ version: "0.1.0",
778
+ description: `LytJS plugin: ${pluginName}`,
779
+ main: "dist/index.cjs",
780
+ module: "dist/index.mjs",
781
+ types: "dist/index.d.ts",
782
+ exports: {
783
+ ".": {
784
+ import: "./dist/index.mjs",
785
+ require: "./dist/index.cjs",
786
+ types: "./dist/index.d.ts"
787
+ }
788
+ },
789
+ files: ["dist"],
790
+ scripts: {
791
+ build: "tsup",
792
+ dev: "tsup --watch",
793
+ test: "vitest",
794
+ lint: "eslint src",
795
+ "prepublishOnly": "npm run build"
796
+ },
797
+ keywords: ["lytjs", "plugin"],
798
+ license: "MIT",
799
+ peerDependencies: {
800
+ "@lytjs/core": ">=6.0.0"
801
+ }
802
+ }, null, 2);
803
+ files["tsconfig.json"] = JSON.stringify({
804
+ extends: "@lytjs/core/tsconfig.json",
805
+ compilerOptions: {
806
+ outDir: "./dist",
807
+ rootDir: "./src",
808
+ declaration: true,
809
+ declarationMap: true
810
+ },
811
+ include: ["src"],
812
+ exclude: ["node_modules", "dist", "tests"]
813
+ }, null, 2);
814
+ files["tsup.config.ts"] = `import { defineConfig } from 'tsup';
815
+
816
+ export default defineConfig({
817
+ entry: { index: 'src/index.ts' },
818
+ format: ['esm', 'cjs'],
819
+ dts: true,
820
+ sourcemap: true,
821
+ clean: true,
822
+ splitting: false,
823
+ treeshake: true,
824
+ minify: false,
825
+ external: ['@lytjs/core'],
826
+ });
827
+ `;
828
+ if (template === "withConfig") {
829
+ files["src/index.ts"] = `/**
830
+ * @lytjs/plugin-${pluginName}
831
+ *
832
+ * A LytJS plugin with configuration schema support.
833
+ */
834
+
835
+ import { definePlugin } from '@lytjs/core';
836
+ import type { ConfigSchema } from '@lytjs/core';
837
+
838
+ /**
839
+ * Plugin options schema
840
+ */
841
+ const optionsSchema: ConfigSchema<${pluginName.replace(/-/g, "")}Options> = {
842
+ type: 'object',
843
+ properties: {
844
+ debug: {
845
+ type: 'boolean',
846
+ description: 'Enable debug mode',
847
+ default: false,
848
+ },
849
+ option1: {
850
+ type: 'string',
851
+ description: 'First option',
852
+ default: 'default value',
853
+ },
854
+ },
855
+ additionalProperties: false,
856
+ };
857
+
858
+ ${pluginName.replace(/-/g, "")}Options\`;
859
+
860
+ export interface ${pluginName.replace(/-/g, "")}Options {
861
+ debug?: boolean;
862
+ option1?: string;
863
+ }
864
+
865
+ /**
866
+ * Create the plugin with configuration schema
867
+ */
868
+ export function create${pluginName.replace(/-/g, "").replace(/^\w/, (c) => c.toUpperCase())}(options?: ${pluginName.replace(/-/g, "")}Options) {
869
+ return definePlugin({
870
+ name: '${packageName}',
871
+ version: '0.1.0',
872
+ description: 'A LytJS plugin',
873
+ schema: optionsSchema,
874
+ install: (app, opts) => {
875
+ const config = opts || {};
876
+ console.log('[${packageName}] Installing with config:', config);
877
+ },
878
+ });
879
+ }
880
+
881
+ /**
882
+ * Direct plugin export (without schema)
883
+ */
884
+ export default create${pluginName.replace(/-/g, "").replace(/^\w/, (c) => c.toUpperCase())}();
885
+ `;
886
+ } else {
887
+ files["src/index.ts"] = `/**
888
+ * @lytjs/plugin-${pluginName}
889
+ *
890
+ * A LytJS plugin.
891
+ */
892
+
893
+ import { definePlugin } from '@lytjs/core';
894
+
895
+ /**
896
+ * Create the plugin
897
+ */
898
+ export function create${pluginName.replace(/-/g, "").replace(/^\w/, (c) => c.toUpperCase())}() {
899
+ return definePlugin({
900
+ name: '${packageName}',
901
+ version: '0.1.0',
902
+ description: 'A LytJS plugin',
903
+ install: (app) => {
904
+ console.log('[${packageName}] Plugin installed');
905
+ },
906
+ });
907
+ }
908
+
909
+ /**
910
+ * Direct plugin export
911
+ */
912
+ export default create${pluginName.replace(/-/g, "").replace(/^\w/, (c) => c.toUpperCase())}();
913
+ `;
914
+ }
915
+ if (template === "minimal") {
916
+ files["src/types.ts"] = `/**
917
+ * Plugin types
918
+ */
919
+
920
+ export interface PluginOptions {
921
+ // Define your plugin options here
922
+ }
923
+ `;
924
+ }
925
+ files["README.md"] = `# @lytjs/plugin-${pluginName}
926
+
927
+ A LytJS plugin.
928
+
929
+ ## Installation
930
+
931
+ \`\`\`bash
932
+ npm install @lytjs/plugin-${pluginName}
933
+ \`\`\`
934
+
935
+ ## Usage
936
+
937
+ \`\`\`typescript
938
+ import { createApp } from '@lytjs/core';
939
+ import myPlugin from '@lytjs/plugin-${pluginName}';
940
+
941
+ const app = createApp(App);
942
+ app.use(myPlugin);
943
+ \`\`\`
944
+
945
+ ## API
946
+
947
+ ### createPlugin(options?)
948
+
949
+ Create the plugin with options.
950
+
951
+ ## License
952
+
953
+ MIT
954
+ `;
955
+ files[".gitignore"] = `# Logs
956
+ logs
957
+ *.log
958
+ npm-debug.log*
959
+ yarn-debug.log*
960
+ pnpm-debug.log*
961
+
962
+ node_modules
963
+ dist
964
+ *.local
965
+
966
+ # IDE
967
+ .vscode
968
+ .idea
969
+ *.sw?
970
+ `;
971
+ return files;
972
+ }
973
+ async function createPlugin(name, options = {}) {
974
+ const targetDir = resolve(process.cwd(), name);
975
+ const template = options.template || "default";
976
+ if (template !== "default" && template !== "minimal" && template !== "withConfig") {
977
+ logger.error(`Unknown template: ${template}`);
978
+ logger.info("Available templates: default, minimal, withConfig");
979
+ process.exit(1);
980
+ }
981
+ if (existsSync(targetDir) && !isEmptyDir2(targetDir) && !options.force) {
982
+ logger.error(`Directory "${name}" already exists and is not empty.`);
983
+ logger.info("Use --force to overwrite.");
984
+ process.exit(1);
985
+ }
986
+ logger.info(`Creating a new LytJS plugin in ${targetDir}...`);
987
+ ensureDir(targetDir);
988
+ const files = getTemplateContent(template, name);
989
+ for (const [filePath, content] of Object.entries(files)) {
990
+ const fullPath = join(targetDir, filePath);
991
+ const fileDir = resolve(fullPath, "..");
992
+ if (!existsSync(fileDir)) {
993
+ mkdirSync(fileDir, { recursive: true });
994
+ }
995
+ writeFileSync(fullPath, content, "utf-8");
996
+ logger.success(`Created: ${filePath}`);
997
+ }
998
+ if (!options.skipInstall) {
999
+ logger.info("Installing dependencies...");
1000
+ try {
1001
+ execSync("pnpm install", { cwd: targetDir, stdio: "inherit" });
1002
+ logger.success("Dependencies installed!");
1003
+ } catch (_error) {
1004
+ logger.warning("Failed to install dependencies automatically.");
1005
+ logger.info('Please run "pnpm install" manually.');
1006
+ }
1007
+ }
1008
+ logger.success(`Plugin "${name}" created successfully!`);
1009
+ logger.info("");
1010
+ logger.bold("Next steps:");
1011
+ logger.info(` cd ${name}`);
1012
+ logger.info(" pnpm dev # Start development");
1013
+ logger.info(" pnpm build # Build for production");
1014
+ logger.info(" pnpm test # Run tests");
1015
+ }
1016
+ async function buildPlugin(options = {}) {
1017
+ const cwd = process.cwd();
1018
+ const outDir = options.outDir || "dist";
1019
+ const pkgPath = join(cwd, "package.json");
1020
+ if (!existsSync(pkgPath)) {
1021
+ logger.error("No package.json found. Are you in a plugin directory?");
1022
+ process.exit(1);
1023
+ }
1024
+ logger.info("Building plugin...");
1025
+ try {
1026
+ const buildCmd = "tsup";
1027
+ const args = ["--entry", "src/index.ts", "--outDir", outDir, "--format", "esm,cjs", "--dts", "--sourcemap"];
1028
+ if (options.minify) {
1029
+ args.push("--minify");
1030
+ }
1031
+ execSync(`${buildCmd} ${args.join(" ")}`, { cwd, stdio: "inherit" });
1032
+ logger.success("Build completed!");
1033
+ logger.info(`Output: ${join(cwd, outDir)}`);
1034
+ } catch (_error) {
1035
+ logger.error("Build failed. Make sure tsup is installed: pnpm add -D tsup");
1036
+ process.exit(1);
1037
+ }
1038
+ }
1039
+ async function validatePlugin(options = {}) {
1040
+ const cwd = process.cwd();
1041
+ logger.info("Validating plugin...");
1042
+ const errors = [];
1043
+ const warnings = [];
1044
+ const pkgPath = join(cwd, "package.json");
1045
+ if (!existsSync(pkgPath)) {
1046
+ errors.push("package.json not found");
1047
+ } else {
1048
+ try {
1049
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
1050
+ if (!pkg.name) errors.push("package.json: name is required");
1051
+ if (!pkg.version) errors.push("package.json: version is required");
1052
+ if (!pkg.main) errors.push("package.json: main is required");
1053
+ if (!pkg.module) errors.push("package.json: module is required");
1054
+ if (!pkg.types) errors.push("package.json: types is required");
1055
+ if (!pkg.exports) {
1056
+ warnings.push("package.json: exports field is recommended");
1057
+ }
1058
+ if (!pkg.peerDependencies || !pkg.peerDependencies["@lytjs/core"]) {
1059
+ errors.push("package.json: @lytjs/core peerDependency is required");
1060
+ }
1061
+ if (!pkg.keywords || !pkg.keywords.includes("lytjs")) {
1062
+ warnings.push('package.json: "lytjs" keyword is recommended');
1063
+ }
1064
+ } catch (err) {
1065
+ errors.push(`package.json: Invalid JSON - ${err}`);
1066
+ }
1067
+ }
1068
+ const srcPath = join(cwd, "src");
1069
+ if (!existsSync(srcPath)) {
1070
+ errors.push("src directory not found");
1071
+ } else {
1072
+ const indexPath = join(srcPath, "index.ts");
1073
+ if (!existsSync(indexPath)) {
1074
+ errors.push("src/index.ts not found");
1075
+ } else {
1076
+ const content = readFileSync(indexPath, "utf-8");
1077
+ if (!content.includes("definePlugin") && !content.includes("EnhancedPlugin")) {
1078
+ warnings.push("src/index.ts: Consider using definePlugin or EnhancedPlugin");
1079
+ }
1080
+ if (!content.includes("export")) {
1081
+ warnings.push("src/index.ts: No exports found");
1082
+ }
1083
+ }
1084
+ }
1085
+ const tsconfigPath = join(cwd, "tsconfig.json");
1086
+ if (!existsSync(tsconfigPath)) {
1087
+ warnings.push("tsconfig.json not found (recommended)");
1088
+ }
1089
+ const tsupConfigPath = join(cwd, "tsup.config.ts");
1090
+ if (!existsSync(tsupConfigPath)) {
1091
+ warnings.push("tsup.config.ts not found (recommended for builds)");
1092
+ }
1093
+ let hasErrors = errors.length > 0;
1094
+ let hasWarnings = warnings.length > 0;
1095
+ if (hasErrors) {
1096
+ logger.error("Validation failed with errors:");
1097
+ for (const err of errors) {
1098
+ logger.error(` - ${err}`);
1099
+ }
1100
+ }
1101
+ if (hasWarnings && !options.strict) {
1102
+ logger.warning("Warnings:");
1103
+ for (const warn of warnings) {
1104
+ logger.warning(` - ${warn}`);
1105
+ }
1106
+ }
1107
+ if (!hasErrors && !hasWarnings) {
1108
+ logger.success("Plugin validation passed!");
1109
+ } else if (hasWarnings && !hasErrors) {
1110
+ logger.success("Plugin validation passed (with warnings)");
1111
+ if (options.strict) {
1112
+ process.exit(1);
1113
+ }
1114
+ } else {
1115
+ if (options.warningsAsErrors && hasWarnings) {
1116
+ logger.error("Strict mode: treating warnings as errors");
1117
+ }
1118
+ process.exit(1);
1119
+ }
1120
+ }
1121
+ function isEmptyDir2(dir) {
1122
+ if (!existsSync(dir)) return true;
1123
+ const files = __require("fs").readdirSync(dir);
1124
+ return files.length === 0;
1125
+ }
1126
+ function listPluginTemplates() {
1127
+ logger.bold("Available plugin templates:");
1128
+ for (const [name, description] of Object.entries(PLUGIN_TEMPLATES)) {
1129
+ logger.info(` ${name.padEnd(12)} - ${description}`);
1130
+ }
1131
+ }
1132
+
1133
+ // src/commands/run.ts
1134
+ var VERSION = "6.0.0";
1135
+ async function runCli(rawArgs = process.argv.slice(2)) {
1136
+ const { command, args, options } = parseArgs(rawArgs);
1137
+ if (options.help || command === "help") {
1138
+ showHelp();
1139
+ return;
1140
+ }
1141
+ if (options.version || command === "version" || command === "-v" || command === "--version") {
1142
+ console.log(`LytJS CLI v${VERSION}`);
1143
+ return;
1144
+ }
1145
+ switch (command) {
1146
+ case "create":
1147
+ await create(args[0] || "my-lytjs-app", {
1148
+ template: options.template,
1149
+ force: options.force
1150
+ });
1151
+ break;
1152
+ case "templates":
1153
+ listTemplates();
1154
+ break;
1155
+ case "dev":
1156
+ await dev({
1157
+ port: options.port ? parseInt(options.port, 10) : void 0,
1158
+ host: options.host,
1159
+ open: options.open
1160
+ });
1161
+ break;
1162
+ case "build":
1163
+ await build({
1164
+ outDir: options.outDir,
1165
+ ssr: options.ssr,
1166
+ minify: options.minify !== "false"
1167
+ });
1168
+ break;
1169
+ case "test":
1170
+ await test({
1171
+ watch: options.watch !== "false",
1172
+ coverage: options.coverage,
1173
+ grep: options.grep
1174
+ });
1175
+ break;
1176
+ case "add":
1177
+ if (!args[0] || !["component", "page", "store"].includes(args[0])) {
1178
+ logger.error("Usage: lyt add <component|page|store> <name>");
1179
+ logger.info("Example: lyt add component Button");
1180
+ process.exit(1);
1181
+ }
1182
+ await add(args[0], args[1] || "Unnamed", {
1183
+ force: options.force
1184
+ });
1185
+ break;
1186
+ case "plugin":
1187
+ if (!args[0]) {
1188
+ logger.error("Usage: lyt plugin <create|build|validate|templates>");
1189
+ logger.info("Example: lyt plugin create my-plugin");
1190
+ process.exit(1);
1191
+ }
1192
+ const subCommand = args[0];
1193
+ switch (subCommand) {
1194
+ case "create":
1195
+ await createPlugin(args[1] || "my-plugin", {
1196
+ template: options.template,
1197
+ force: options.force,
1198
+ skipInstall: options.skipInstall
1199
+ });
1200
+ break;
1201
+ case "build":
1202
+ await buildPlugin({
1203
+ outDir: options.outDir,
1204
+ minify: options.minify,
1205
+ sourcemap: options.sourcemap
1206
+ });
1207
+ break;
1208
+ case "validate":
1209
+ await validatePlugin({
1210
+ strict: options.strict,
1211
+ warningsAsErrors: options.warningsAsErrors
1212
+ });
1213
+ break;
1214
+ case "templates":
1215
+ listPluginTemplates();
1216
+ break;
1217
+ default:
1218
+ logger.error(`Unknown plugin sub-command: ${subCommand}`);
1219
+ logger.info("Supported sub-commands: create, build, validate, templates");
1220
+ process.exit(1);
1221
+ }
1222
+ break;
1223
+ default:
1224
+ if (command) {
1225
+ logger.error(`Unknown command: ${command}`);
1226
+ logger.info('Run "lyt --help" for usage information.');
1227
+ process.exit(1);
1228
+ } else {
1229
+ showHelp();
1230
+ }
1231
+ }
1232
+ }
1233
+ function parseArgs(args) {
1234
+ let command = args[0] ?? "";
1235
+ const positional = [];
1236
+ const options = {};
1237
+ if (command.startsWith("--") || command.startsWith("-")) {
1238
+ command = "";
1239
+ }
1240
+ const startIndex = command ? 1 : 0;
1241
+ for (let i = startIndex; i < args.length; i++) {
1242
+ const arg = args[i] ?? "";
1243
+ if (arg.startsWith("--")) {
1244
+ const parts = arg.slice(2).split("=");
1245
+ const key = parts[0];
1246
+ const value = parts[1];
1247
+ if (value !== void 0 && key) {
1248
+ options[key] = value;
1249
+ } else if (key && i + 1 < args.length && !(args[i + 1] ?? "").startsWith("-")) {
1250
+ const nextArg = args[++i];
1251
+ if (nextArg) {
1252
+ options[key] = nextArg;
1253
+ }
1254
+ } else if (key) {
1255
+ options[key] = true;
1256
+ }
1257
+ } else if (arg.startsWith("-")) {
1258
+ const key = arg.slice(1);
1259
+ if (key) {
1260
+ options[key] = true;
1261
+ }
1262
+ } else {
1263
+ positional.push(arg);
1264
+ }
1265
+ }
1266
+ return { command, args: positional, options };
1267
+ }
1268
+ function showHelp() {
1269
+ console.log(`
1270
+ ${logger.bold("LytJS CLI")} v${VERSION}
1271
+
1272
+ ${logger.bold("Usage:")}
1273
+ lyt <command> [options]
1274
+
1275
+ ${logger.bold("Commands:")}
1276
+ create <name> Create a new LytJS project
1277
+ templates List available templates
1278
+ dev Start development server
1279
+ build Build for production
1280
+ test Run tests
1281
+ add <type> <name> Generate a component, page, or store
1282
+ plugin <subcmd> Plugin development commands
1283
+ help Show this help message
1284
+
1285
+ ${logger.bold("Options:")}
1286
+ --version, -v Show version number
1287
+ --help Show help
1288
+
1289
+ ${logger.bold("Create Options:")}
1290
+ --template <name> Use a specific template
1291
+ --force Overwrite existing directory
1292
+
1293
+ ${logger.bold("Dev Options:")}
1294
+ --port <number> Specify port (default: 5173)
1295
+ --host <host> Specify host (default: localhost)
1296
+ --open Open browser on start
1297
+
1298
+ ${logger.bold("Build Options:")}
1299
+ --outDir <dir> Output directory (default: dist)
1300
+ --ssr Build for SSR
1301
+ --minify false Disable minification
1302
+
1303
+ ${logger.bold("Test Options:")}
1304
+ --watch false Run tests once (no watch mode)
1305
+ --coverage Generate coverage report
1306
+ --grep <pattern> Filter tests by pattern
1307
+
1308
+ ${logger.bold("Plugin Options:")}
1309
+ --template <name> Use a specific plugin template (default, minimal, withConfig)
1310
+ --force Overwrite existing directory
1311
+ --skipInstall Skip installing dependencies
1312
+ --outDir <dir> Output directory (default: dist)
1313
+ --minify Minify output
1314
+ --sourcemap Generate sourcemaps
1315
+ --strict Strict validation mode
1316
+ --warningsAsErrors Treat warnings as errors
1317
+
1318
+ ${logger.bold("Examples:")}
1319
+ lyt create my-app
1320
+ lyt create my-app --template minimal
1321
+ lyt create my-app --template router
1322
+ lyt create my-app --template full
1323
+ lyt dev --port 3000
1324
+ lyt build --ssr
1325
+ lyt add component Button
1326
+ lyt add page About
1327
+ lyt add store user
1328
+ lyt plugin create my-plugin
1329
+ lyt plugin create my-plugin --template withConfig
1330
+ lyt plugin build
1331
+ lyt plugin validate
1332
+ `);
1333
+ }
1334
+
1335
+ // src/index.ts
1336
+ if (__require.main === module) {
1337
+ runCli().catch(console.error);
1338
+ }
1339
+
1340
+ export { add, build, buildPlugin, create, createPlugin, detectPackageManager, dev, ensureDir, exists, getAddCommand, getInstallCommand, getRunCommand, listPluginTemplates, listTemplates, logger, readFile, runCli, test, validatePlugin, writeFile };
1341
+ //# sourceMappingURL=lyt.mjs.map
1342
+ //# sourceMappingURL=lyt.mjs.map