@sigx/cli 0.1.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 (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +78 -0
  3. package/dist/cli.js +230 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/create.d.ts +1 -0
  6. package/dist/commands/create.js +411 -0
  7. package/dist/commands/create.js.map +1 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +2 -0
  10. package/dist/plugin.d.ts +26 -0
  11. package/dist/plugin.js +11 -0
  12. package/dist/plugin.js.map +1 -0
  13. package/dist/templates/basic/index.html +32 -0
  14. package/dist/templates/basic/package.json +19 -0
  15. package/dist/templates/basic/src/App.tsx +35 -0
  16. package/dist/templates/basic/tsconfig.json +13 -0
  17. package/dist/templates/basic/vite.config.ts +15 -0
  18. package/dist/templates/basic-daisyui/index.html +14 -0
  19. package/dist/templates/basic-daisyui/package.json +23 -0
  20. package/dist/templates/basic-daisyui/src/App.tsx +165 -0
  21. package/dist/templates/basic-daisyui/src/style.css +5 -0
  22. package/dist/templates/basic-daisyui/tsconfig.json +13 -0
  23. package/dist/templates/basic-daisyui/vite.config.ts +17 -0
  24. package/dist/templates/basic-tailwind/index.html +13 -0
  25. package/dist/templates/basic-tailwind/package.json +21 -0
  26. package/dist/templates/basic-tailwind/src/App.tsx +37 -0
  27. package/dist/templates/basic-tailwind/src/style.css +1 -0
  28. package/dist/templates/basic-tailwind/tsconfig.json +13 -0
  29. package/dist/templates/basic-tailwind/vite.config.ts +17 -0
  30. package/dist/templates/lynx/README.md +57 -0
  31. package/dist/templates/lynx/assets/adaptive-foreground.png +0 -0
  32. package/dist/templates/lynx/assets/icon.png +0 -0
  33. package/dist/templates/lynx/assets/splash.png +0 -0
  34. package/dist/templates/lynx/lynx.config.ts +17 -0
  35. package/dist/templates/lynx/package.json +28 -0
  36. package/dist/templates/lynx/sigx.lynx.config.ts +46 -0
  37. package/dist/templates/lynx/src/App.tsx +103 -0
  38. package/dist/templates/lynx/src/main.thread.tsx +2 -0
  39. package/dist/templates/lynx/src/main.tsx +8 -0
  40. package/dist/templates/lynx/tsconfig.json +19 -0
  41. package/dist/templates/lynx-tailwind/README.md +61 -0
  42. package/dist/templates/lynx-tailwind/assets/adaptive-foreground.png +0 -0
  43. package/dist/templates/lynx-tailwind/assets/icon.png +0 -0
  44. package/dist/templates/lynx-tailwind/assets/splash.png +0 -0
  45. package/dist/templates/lynx-tailwind/lynx.config.ts +20 -0
  46. package/dist/templates/lynx-tailwind/package.json +32 -0
  47. package/dist/templates/lynx-tailwind/postcss.config.js +5 -0
  48. package/dist/templates/lynx-tailwind/sigx.lynx.config.ts +44 -0
  49. package/dist/templates/lynx-tailwind/src/App.tsx +52 -0
  50. package/dist/templates/lynx-tailwind/src/main.thread.tsx +2 -0
  51. package/dist/templates/lynx-tailwind/src/main.tsx +9 -0
  52. package/dist/templates/lynx-tailwind/src/styles.css +3 -0
  53. package/dist/templates/lynx-tailwind/tailwind.config.ts +9 -0
  54. package/dist/templates/lynx-tailwind/tsconfig.json +19 -0
  55. package/dist/templates/ssg/index.html +25 -0
  56. package/dist/templates/ssg/package.json +22 -0
  57. package/dist/templates/ssg/src/layouts/default.tsx +27 -0
  58. package/dist/templates/ssg/src/pages/about.mdx +15 -0
  59. package/dist/templates/ssg/src/pages/index.mdx +37 -0
  60. package/dist/templates/ssg/ssg.config.ts +20 -0
  61. package/dist/templates/ssg/tsconfig.json +14 -0
  62. package/dist/templates/ssg/vite.config.ts +16 -0
  63. package/dist/templates/ssg-daisyui/index.html +13 -0
  64. package/dist/templates/ssg-daisyui/package.json +26 -0
  65. package/dist/templates/ssg-daisyui/src/layouts/default.tsx +39 -0
  66. package/dist/templates/ssg-daisyui/src/pages/about.mdx +17 -0
  67. package/dist/templates/ssg-daisyui/src/pages/index.mdx +34 -0
  68. package/dist/templates/ssg-daisyui/src/style.css +5 -0
  69. package/dist/templates/ssg-daisyui/ssg.config.ts +20 -0
  70. package/dist/templates/ssg-daisyui/tsconfig.json +14 -0
  71. package/dist/templates/ssg-daisyui/vite.config.ts +18 -0
  72. package/dist/templates/ssg-tailwind/index.html +12 -0
  73. package/dist/templates/ssg-tailwind/package.json +24 -0
  74. package/dist/templates/ssg-tailwind/src/layouts/default.tsx +29 -0
  75. package/dist/templates/ssg-tailwind/src/pages/about.mdx +16 -0
  76. package/dist/templates/ssg-tailwind/src/pages/index.mdx +37 -0
  77. package/dist/templates/ssg-tailwind/src/style.css +1 -0
  78. package/dist/templates/ssg-tailwind/ssg.config.ts +20 -0
  79. package/dist/templates/ssg-tailwind/tsconfig.json +14 -0
  80. package/dist/templates/ssg-tailwind/vite.config.ts +18 -0
  81. package/dist/templates/ssr/index.html +12 -0
  82. package/dist/templates/ssr/package.json +24 -0
  83. package/dist/templates/ssr/src/App.tsx +32 -0
  84. package/dist/templates/ssr/src/entry-client.tsx +25 -0
  85. package/dist/templates/ssr/src/entry-server.tsx +24 -0
  86. package/dist/templates/ssr/src/pages/About.tsx +20 -0
  87. package/dist/templates/ssr/src/pages/Home.tsx +31 -0
  88. package/dist/templates/ssr/src/router.ts +27 -0
  89. package/dist/templates/ssr/tsconfig.json +13 -0
  90. package/dist/templates/ssr/vite.config.ts +18 -0
  91. package/dist/templates/ssr-daisyui/index.html +14 -0
  92. package/dist/templates/ssr-daisyui/package.json +28 -0
  93. package/dist/templates/ssr-daisyui/src/App.tsx +55 -0
  94. package/dist/templates/ssr-daisyui/src/entry-client.tsx +25 -0
  95. package/dist/templates/ssr-daisyui/src/entry-server.tsx +24 -0
  96. package/dist/templates/ssr-daisyui/src/pages/About.tsx +104 -0
  97. package/dist/templates/ssr-daisyui/src/pages/Home.tsx +133 -0
  98. package/dist/templates/ssr-daisyui/src/router.ts +27 -0
  99. package/dist/templates/ssr-daisyui/src/style.css +5 -0
  100. package/dist/templates/ssr-daisyui/tsconfig.json +13 -0
  101. package/dist/templates/ssr-daisyui/vite.config.ts +20 -0
  102. package/dist/templates/ssr-tailwind/index.html +13 -0
  103. package/dist/templates/ssr-tailwind/package.json +26 -0
  104. package/dist/templates/ssr-tailwind/src/App.tsx +32 -0
  105. package/dist/templates/ssr-tailwind/src/entry-client.tsx +25 -0
  106. package/dist/templates/ssr-tailwind/src/entry-server.tsx +24 -0
  107. package/dist/templates/ssr-tailwind/src/pages/About.tsx +21 -0
  108. package/dist/templates/ssr-tailwind/src/pages/Home.tsx +31 -0
  109. package/dist/templates/ssr-tailwind/src/router.ts +27 -0
  110. package/dist/templates/ssr-tailwind/src/style.css +1 -0
  111. package/dist/templates/ssr-tailwind/tsconfig.json +13 -0
  112. package/dist/templates/ssr-tailwind/vite.config.ts +20 -0
  113. package/package.json +65 -0
  114. package/templates/basic/index.html +32 -0
  115. package/templates/basic/package.json +19 -0
  116. package/templates/basic/src/App.tsx +35 -0
  117. package/templates/basic/tsconfig.json +13 -0
  118. package/templates/basic/vite.config.ts +15 -0
  119. package/templates/basic-daisyui/index.html +14 -0
  120. package/templates/basic-daisyui/package.json +23 -0
  121. package/templates/basic-daisyui/src/App.tsx +165 -0
  122. package/templates/basic-daisyui/src/style.css +5 -0
  123. package/templates/basic-daisyui/tsconfig.json +13 -0
  124. package/templates/basic-daisyui/vite.config.ts +17 -0
  125. package/templates/basic-tailwind/index.html +13 -0
  126. package/templates/basic-tailwind/package.json +21 -0
  127. package/templates/basic-tailwind/src/App.tsx +37 -0
  128. package/templates/basic-tailwind/src/style.css +1 -0
  129. package/templates/basic-tailwind/tsconfig.json +13 -0
  130. package/templates/basic-tailwind/vite.config.ts +17 -0
  131. package/templates/lynx/README.md +57 -0
  132. package/templates/lynx/assets/adaptive-foreground.png +0 -0
  133. package/templates/lynx/assets/icon.png +0 -0
  134. package/templates/lynx/assets/splash.png +0 -0
  135. package/templates/lynx/lynx.config.ts +17 -0
  136. package/templates/lynx/package.json +28 -0
  137. package/templates/lynx/sigx.lynx.config.ts +46 -0
  138. package/templates/lynx/src/App.tsx +103 -0
  139. package/templates/lynx/src/main.thread.tsx +2 -0
  140. package/templates/lynx/src/main.tsx +8 -0
  141. package/templates/lynx/tsconfig.json +19 -0
  142. package/templates/lynx-tailwind/README.md +61 -0
  143. package/templates/lynx-tailwind/assets/adaptive-foreground.png +0 -0
  144. package/templates/lynx-tailwind/assets/icon.png +0 -0
  145. package/templates/lynx-tailwind/assets/splash.png +0 -0
  146. package/templates/lynx-tailwind/lynx.config.ts +20 -0
  147. package/templates/lynx-tailwind/package.json +32 -0
  148. package/templates/lynx-tailwind/postcss.config.js +5 -0
  149. package/templates/lynx-tailwind/sigx.lynx.config.ts +44 -0
  150. package/templates/lynx-tailwind/src/App.tsx +52 -0
  151. package/templates/lynx-tailwind/src/main.thread.tsx +2 -0
  152. package/templates/lynx-tailwind/src/main.tsx +9 -0
  153. package/templates/lynx-tailwind/src/styles.css +3 -0
  154. package/templates/lynx-tailwind/tailwind.config.ts +9 -0
  155. package/templates/lynx-tailwind/tsconfig.json +19 -0
  156. package/templates/ssg/index.html +25 -0
  157. package/templates/ssg/package.json +22 -0
  158. package/templates/ssg/src/layouts/default.tsx +27 -0
  159. package/templates/ssg/src/pages/about.mdx +15 -0
  160. package/templates/ssg/src/pages/index.mdx +37 -0
  161. package/templates/ssg/ssg.config.ts +20 -0
  162. package/templates/ssg/tsconfig.json +14 -0
  163. package/templates/ssg/vite.config.ts +16 -0
  164. package/templates/ssg-daisyui/index.html +13 -0
  165. package/templates/ssg-daisyui/package.json +26 -0
  166. package/templates/ssg-daisyui/src/layouts/default.tsx +39 -0
  167. package/templates/ssg-daisyui/src/pages/about.mdx +17 -0
  168. package/templates/ssg-daisyui/src/pages/index.mdx +34 -0
  169. package/templates/ssg-daisyui/src/style.css +5 -0
  170. package/templates/ssg-daisyui/ssg.config.ts +20 -0
  171. package/templates/ssg-daisyui/tsconfig.json +14 -0
  172. package/templates/ssg-daisyui/vite.config.ts +18 -0
  173. package/templates/ssg-tailwind/index.html +12 -0
  174. package/templates/ssg-tailwind/package.json +24 -0
  175. package/templates/ssg-tailwind/src/layouts/default.tsx +29 -0
  176. package/templates/ssg-tailwind/src/pages/about.mdx +16 -0
  177. package/templates/ssg-tailwind/src/pages/index.mdx +37 -0
  178. package/templates/ssg-tailwind/src/style.css +1 -0
  179. package/templates/ssg-tailwind/ssg.config.ts +20 -0
  180. package/templates/ssg-tailwind/tsconfig.json +14 -0
  181. package/templates/ssg-tailwind/vite.config.ts +18 -0
  182. package/templates/ssr/index.html +12 -0
  183. package/templates/ssr/package.json +24 -0
  184. package/templates/ssr/src/App.tsx +32 -0
  185. package/templates/ssr/src/entry-client.tsx +25 -0
  186. package/templates/ssr/src/entry-server.tsx +24 -0
  187. package/templates/ssr/src/pages/About.tsx +20 -0
  188. package/templates/ssr/src/pages/Home.tsx +31 -0
  189. package/templates/ssr/src/router.ts +27 -0
  190. package/templates/ssr/tsconfig.json +13 -0
  191. package/templates/ssr/vite.config.ts +18 -0
  192. package/templates/ssr-daisyui/index.html +14 -0
  193. package/templates/ssr-daisyui/package.json +28 -0
  194. package/templates/ssr-daisyui/src/App.tsx +55 -0
  195. package/templates/ssr-daisyui/src/entry-client.tsx +25 -0
  196. package/templates/ssr-daisyui/src/entry-server.tsx +24 -0
  197. package/templates/ssr-daisyui/src/pages/About.tsx +104 -0
  198. package/templates/ssr-daisyui/src/pages/Home.tsx +133 -0
  199. package/templates/ssr-daisyui/src/router.ts +27 -0
  200. package/templates/ssr-daisyui/src/style.css +5 -0
  201. package/templates/ssr-daisyui/tsconfig.json +13 -0
  202. package/templates/ssr-daisyui/vite.config.ts +20 -0
  203. package/templates/ssr-tailwind/index.html +13 -0
  204. package/templates/ssr-tailwind/package.json +26 -0
  205. package/templates/ssr-tailwind/src/App.tsx +32 -0
  206. package/templates/ssr-tailwind/src/entry-client.tsx +25 -0
  207. package/templates/ssr-tailwind/src/entry-server.tsx +24 -0
  208. package/templates/ssr-tailwind/src/pages/About.tsx +21 -0
  209. package/templates/ssr-tailwind/src/pages/Home.tsx +31 -0
  210. package/templates/ssr-tailwind/src/router.ts +27 -0
  211. package/templates/ssr-tailwind/src/style.css +1 -0
  212. package/templates/ssr-tailwind/tsconfig.json +13 -0
  213. package/templates/ssr-tailwind/vite.config.ts +20 -0
@@ -0,0 +1,133 @@
1
+ import { component, effect } from 'sigx';
2
+ import { Button, Card, Badge, Toggle, Stats, Stat, Hero } from '@sigx/daisyui';
3
+
4
+ export const Home = component(({ signal }) => {
5
+ const state = signal({
6
+ count: 0,
7
+ autoIncrement: false,
8
+ elapsed: 0,
9
+ });
10
+
11
+ // Auto-increment effect — shows reactive effects in action
12
+ effect(() => {
13
+ if (!state.autoIncrement) return;
14
+ const timer = setInterval(() => state.count++, 800);
15
+ return () => clearInterval(timer);
16
+ });
17
+
18
+ // Elapsed timer — shows independent reactive state
19
+ effect(() => {
20
+ const timer = setInterval(() => state.elapsed++, 1000);
21
+ return () => clearInterval(timer);
22
+ });
23
+
24
+ const formatTime = (s: number) => {
25
+ const m = Math.floor(s / 60);
26
+ const sec = s % 60;
27
+ return `${m}:${sec.toString().padStart(2, '0')}`;
28
+ };
29
+
30
+ return () => (
31
+ <div>
32
+ {/* Hero */}
33
+ <Hero class="bg-base-100 py-20">
34
+ <Hero.Content>
35
+ <div class="max-w-2xl">
36
+ <h1 class="text-5xl font-bold leading-tight">
37
+ Build Reactive Apps<br />
38
+ <span class="text-primary">with SignalX</span>
39
+ </h1>
40
+ <p class="py-6 text-lg text-base-content/70">
41
+ Fine-grained reactivity, SSR streaming, and a beautiful component library —
42
+ everything you need to build modern web applications.
43
+ </p>
44
+ <div class="flex gap-3 justify-center">
45
+ <Button variant="primary" size="lg">Get Started</Button>
46
+ <Button variant="ghost" size="lg" outline>Documentation</Button>
47
+ </div>
48
+ </div>
49
+ </Hero.Content>
50
+ </Hero>
51
+
52
+ {/* Stats — all reactive */}
53
+ <div class="px-6 -mt-8 relative z-10 flex justify-center">
54
+ <Stats class="w-full max-w-3xl bg-base-100">
55
+ <Stat title="Counter" value={state.count} description="Reactive signal" />
56
+ <Stat title="Doubled" value={state.count * 2} description="Computed value" />
57
+ <Stat title="Uptime" value={formatTime(state.elapsed)} description="Live timer" />
58
+ </Stats>
59
+ </div>
60
+
61
+ {/* Features */}
62
+ <section class="py-16 px-6">
63
+ <div class="max-w-5xl mx-auto">
64
+ <h2 class="text-3xl font-bold text-center mb-12">Why SignalX?</h2>
65
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
66
+ <Card bordered>
67
+ <Card.Body>
68
+ <Card.Title>⚡ Fine-grained Reactivity</Card.Title>
69
+ <p class="text-base-content/70">
70
+ Signals update only what changed — no virtual DOM diffing,
71
+ no unnecessary re-renders. Surgical precision updates.
72
+ </p>
73
+ </Card.Body>
74
+ </Card>
75
+ <Card bordered>
76
+ <Card.Body>
77
+ <Card.Title>🌊 SSR Streaming</Card.Title>
78
+ <p class="text-base-content/70">
79
+ Server-side render your app with streaming HTML.
80
+ Instant first paint, seamless hydration, full interactivity.
81
+ </p>
82
+ </Card.Body>
83
+ </Card>
84
+ <Card bordered>
85
+ <Card.Body>
86
+ <Card.Title>🎨 DaisyUI Themes</Card.Title>
87
+ <p class="text-base-content/70">
88
+ 30+ built-in themes, dark mode, and full component library.
89
+ Switch the theme above to see it in action!
90
+ </p>
91
+ </Card.Body>
92
+ </Card>
93
+ </div>
94
+ </div>
95
+ </section>
96
+
97
+ {/* Interactive Demo */}
98
+ <section class="py-16 px-6 bg-base-100">
99
+ <div class="max-w-xl mx-auto">
100
+ <h2 class="text-3xl font-bold text-center mb-2">Try It Live</h2>
101
+ <p class="text-center text-base-content/60 mb-8">Interact with reactive signals right here</p>
102
+
103
+ <Card shadow="lg" bordered>
104
+ <Card.Body center>
105
+ <div class="flex items-center gap-4 mb-6">
106
+ <Badge variant="primary" size="lg">{state.count}</Badge>
107
+ <span class="text-base-content/60">×2 =</span>
108
+ <Badge variant="secondary" size="lg">{state.count * 2}</Badge>
109
+ </div>
110
+ <Card.Actions justify="center">
111
+ <Button variant="primary" onClick={() => state.count++}>
112
+ + Increment
113
+ </Button>
114
+ <Button variant="error" outline onClick={() => state.count--}>
115
+ − Decrement
116
+ </Button>
117
+ <Button variant="ghost" onClick={() => (state.count = 0)}>
118
+ Reset
119
+ </Button>
120
+ </Card.Actions>
121
+ <div class="divider">AUTO MODE</div>
122
+ <Toggle
123
+ onChange={(val: boolean) => (state.autoIncrement = val)}
124
+ label="Auto-increment every 800ms"
125
+ color="success"
126
+ />
127
+ </Card.Body>
128
+ </Card>
129
+ </div>
130
+ </section>
131
+ </div>
132
+ );
133
+ });
@@ -0,0 +1,27 @@
1
+ import {
2
+ createRouter,
3
+ createWebHistory,
4
+ createMemoryHistory,
5
+ type RouteRecordRaw
6
+ } from '@sigx/router';
7
+ import { Home } from './pages/Home';
8
+ import { About } from './pages/About';
9
+
10
+ export const routes: RouteRecordRaw[] = [
11
+ { path: '/', name: 'home', component: Home },
12
+ { path: '/about', name: 'about', component: About }
13
+ ];
14
+
15
+ export function createClientRouter() {
16
+ return createRouter({
17
+ history: createWebHistory(),
18
+ routes
19
+ });
20
+ }
21
+
22
+ export function createServerRouter(url: string) {
23
+ return createRouter({
24
+ history: createMemoryHistory({ initialLocation: url }),
25
+ routes
26
+ });
27
+ }
@@ -0,0 +1,5 @@
1
+ @import "tailwindcss";
2
+ @source "../../node_modules/@sigx/daisyui/dist/**/*.js";
3
+ @plugin "daisyui" {
4
+ themes: light --default, dark --prefersdark, cupcake, synthwave, cyberpunk, dracula, nord, autumn;
5
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "jsx": "react-jsx",
5
+ "jsxImportSource": "sigx",
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "strict": true,
9
+ "noEmit": true,
10
+ "skipLibCheck": true
11
+ },
12
+ "include": ["src/**/*.ts", "src/**/*.tsx"]
13
+ }
@@ -0,0 +1,20 @@
1
+ import { defineConfig } from 'vite';
2
+ import { sigxPlugin } from '@sigx/vite';
3
+ import tailwindcss from '@tailwindcss/vite';
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ sigxPlugin(),
8
+ tailwindcss()
9
+ ],
10
+ build: {
11
+ outDir: 'dist/client'
12
+ },
13
+ // Vite 8 uses oxc instead of esbuild for JSX transforms
14
+ oxc: {
15
+ jsx: {
16
+ runtime: 'automatic',
17
+ importSource: 'sigx'
18
+ }
19
+ }
20
+ });
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{projectName}}</title>
7
+ <link rel="stylesheet" href="/src/style.css" />
8
+ </head>
9
+ <body class="bg-gray-100 text-gray-900">
10
+ <div id="app"><!--app-html--></div>
11
+ <script type="module" src="/src/entry-client.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "node server.js",
8
+ "build": "vite build && vite build --ssr src/entry-server.tsx --outDir dist/server",
9
+ "start": "cross-env NODE_ENV=production node server.js",
10
+ "preview": "cross-env NODE_ENV=production node server.js"
11
+ },
12
+ "dependencies": {
13
+ "sigx": "^0.4.1",
14
+ "@sigx/server-renderer": "^0.4.1",
15
+ "@sigx/router": "^0.3.2",
16
+ "express": "^4.18.2"
17
+ },
18
+ "devDependencies": {
19
+ "@sigx/vite": "^0.4.1",
20
+ "cross-env": "^7.0.3",
21
+ "vite": "^8.0.3",
22
+ "typescript": "^5.9.3",
23
+ "tailwindcss": "^4.1.0",
24
+ "@tailwindcss/vite": "^4.2.2"
25
+ }
26
+ }
@@ -0,0 +1,32 @@
1
+ import { component } from 'sigx';
2
+ import { RouterView, Link, useRoute } from '@sigx/router';
3
+
4
+ export const App = component(() => {
5
+ const route = useRoute();
6
+
7
+ return () => (
8
+ <div class="max-w-2xl mx-auto p-10">
9
+ <header class="bg-gray-800 text-white p-4 mb-8 rounded-lg flex justify-between items-center">
10
+ <h1 class="text-xl font-bold">🚀 {{projectName}}</h1>
11
+ <nav class="flex gap-4">
12
+ <Link
13
+ to="/"
14
+ class={`text-white no-underline px-4 py-2 rounded ${route.path === '/' ? 'bg-blue-500' : 'hover:bg-gray-700'}`}
15
+ >
16
+ Home
17
+ </Link>
18
+ <Link
19
+ to="/about"
20
+ class={`text-white no-underline px-4 py-2 rounded ${route.path === '/about' ? 'bg-blue-500' : 'hover:bg-gray-700'}`}
21
+ >
22
+ About
23
+ </Link>
24
+ </nav>
25
+ </header>
26
+
27
+ <main class="bg-white p-8 rounded-lg shadow-sm">
28
+ <RouterView />
29
+ </main>
30
+ </div>
31
+ );
32
+ });
@@ -0,0 +1,25 @@
1
+ import { defineApp } from 'sigx';
2
+ import { ssrClientPlugin } from '@sigx/server-renderer/client';
3
+ import { App } from './App';
4
+ import { createClientRouter } from './router';
5
+
6
+ const router = createClientRouter();
7
+
8
+ function startHydration() {
9
+ defineApp(<App />)
10
+ .use(router)
11
+ .use(ssrClientPlugin)
12
+ .hydrate('#app');
13
+ }
14
+
15
+ if (window.__SIGX_STREAMING_COMPLETE__) {
16
+ startHydration();
17
+ } else {
18
+ window.addEventListener('sigx:ready', startHydration, { once: true });
19
+ }
20
+
21
+ declare global {
22
+ interface Window {
23
+ __SIGX_STREAMING_COMPLETE__?: boolean;
24
+ }
25
+ }
@@ -0,0 +1,24 @@
1
+ import { defineApp } from 'sigx';
2
+ import { renderToString, renderToStreamWithCallbacks } from '@sigx/server-renderer/server';
3
+ import { App } from './App';
4
+ import { createServerRouter } from './router';
5
+
6
+ function createApp(url: string) {
7
+ const router = createServerRouter(url);
8
+ return defineApp(<App />).use(router);
9
+ }
10
+
11
+ export async function render(url: string) {
12
+ const app = createApp(url);
13
+ return await renderToString(app);
14
+ }
15
+
16
+ export async function renderStreamWithCallback(url: string, callbacks: {
17
+ onShellReady: (html: string) => void;
18
+ onAsyncChunk: (chunk: string) => void;
19
+ onComplete: () => void;
20
+ onError: (error: Error) => void;
21
+ }) {
22
+ const app = createApp(url);
23
+ return await renderToStreamWithCallbacks(app, callbacks);
24
+ }
@@ -0,0 +1,21 @@
1
+ import { component } from 'sigx';
2
+
3
+ export const About = component(() => {
4
+ return () => (
5
+ <div>
6
+ <h2 class="text-2xl font-bold text-gray-800 mb-4">About</h2>
7
+ <p class="text-gray-600 mb-4">
8
+ This is a SignalX SSR application with streaming server-side rendering,
9
+ client-side hydration, and file-based routing.
10
+ </p>
11
+ <ul class="text-gray-600 space-y-2">
12
+ <li>⚡ Streaming SSR with Express</li>
13
+ <li>🔄 Client-side hydration</li>
14
+ <li>🧭 Router with <code class="bg-gray-200 px-2 py-1 rounded">@sigx/router</code></li>
15
+ <li>🎨 Tailwind CSS styling</li>
16
+ <li>📡 API routes ready (<code class="bg-gray-200 px-2 py-1 rounded">/api/hello</code>)</li>
17
+ <li>🏗️ Production build support</li>
18
+ </ul>
19
+ </div>
20
+ );
21
+ });
@@ -0,0 +1,31 @@
1
+ import { component } from 'sigx';
2
+
3
+ export const Home = component(({ signal }) => {
4
+ const state = signal({ count: 0 });
5
+
6
+ return () => (
7
+ <div>
8
+ <h2 class="text-2xl font-bold text-gray-800 mb-4">Home</h2>
9
+ <p class="text-gray-600 mb-6">
10
+ Welcome to your SignalX SSR app! Edit <code class="bg-gray-200 px-2 py-1 rounded">src/pages/Home.tsx</code> to get started.
11
+ </p>
12
+ <div class="bg-gray-50 p-8 rounded-xl text-center">
13
+ <p class="text-6xl font-bold mb-6">{state.count}</p>
14
+ <div class="flex gap-4 justify-center">
15
+ <button
16
+ onClick={() => state.count++}
17
+ class="px-6 py-3 text-lg font-medium bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors cursor-pointer"
18
+ >
19
+ Increment
20
+ </button>
21
+ <button
22
+ onClick={() => state.count--}
23
+ class="px-6 py-3 text-lg font-medium bg-red-500 text-white rounded-lg hover:bg-red-600 transition-colors cursor-pointer"
24
+ >
25
+ Decrement
26
+ </button>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ );
31
+ });
@@ -0,0 +1,27 @@
1
+ import {
2
+ createRouter,
3
+ createWebHistory,
4
+ createMemoryHistory,
5
+ type RouteRecordRaw
6
+ } from '@sigx/router';
7
+ import { Home } from './pages/Home';
8
+ import { About } from './pages/About';
9
+
10
+ export const routes: RouteRecordRaw[] = [
11
+ { path: '/', name: 'home', component: Home },
12
+ { path: '/about', name: 'about', component: About }
13
+ ];
14
+
15
+ export function createClientRouter() {
16
+ return createRouter({
17
+ history: createWebHistory(),
18
+ routes
19
+ });
20
+ }
21
+
22
+ export function createServerRouter(url: string) {
23
+ return createRouter({
24
+ history: createMemoryHistory({ initialLocation: url }),
25
+ routes
26
+ });
27
+ }
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "jsx": "react-jsx",
5
+ "jsxImportSource": "sigx",
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "strict": true,
9
+ "noEmit": true,
10
+ "skipLibCheck": true
11
+ },
12
+ "include": ["src/**/*.ts", "src/**/*.tsx"]
13
+ }
@@ -0,0 +1,20 @@
1
+ import { defineConfig } from 'vite';
2
+ import { sigxPlugin } from '@sigx/vite';
3
+ import tailwindcss from '@tailwindcss/vite';
4
+
5
+ export default defineConfig({
6
+ plugins: [
7
+ sigxPlugin(),
8
+ tailwindcss()
9
+ ],
10
+ build: {
11
+ outDir: 'dist/client'
12
+ },
13
+ // Vite 8 uses oxc instead of esbuild for JSX transforms
14
+ oxc: {
15
+ jsx: {
16
+ runtime: 'automatic',
17
+ importSource: 'sigx'
18
+ }
19
+ }
20
+ });
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@sigx/cli",
3
+ "version": "0.1.0",
4
+ "description": "Unified CLI for SignalX — create, dev, build, and run projects",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "sigx": "./dist/cli.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./plugin": {
17
+ "import": "./dist/plugin.js",
18
+ "types": "./dist/plugin.d.ts"
19
+ },
20
+ "./create": {
21
+ "import": "./dist/commands/create.js",
22
+ "types": "./dist/commands/create.d.ts"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "templates"
28
+ ],
29
+ "dependencies": {
30
+ "@sigx/terminal": "^0.3.2",
31
+ "citty": "^0.2.2"
32
+ },
33
+ "devDependencies": {
34
+ "@sigx/vite": "^0.4.1",
35
+ "@types/node": "^22.0.0",
36
+ "typescript": "^5.9.3",
37
+ "vite": "^8.0.3"
38
+ },
39
+ "author": "Andreas Ekdahl",
40
+ "license": "MIT",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/signalxjs/cli.git",
44
+ "directory": "packages/cli"
45
+ },
46
+ "homepage": "https://github.com/signalxjs/cli/tree/main/packages/cli",
47
+ "bugs": {
48
+ "url": "https://github.com/signalxjs/cli/issues"
49
+ },
50
+ "keywords": [
51
+ "signalx",
52
+ "sigx",
53
+ "cli",
54
+ "scaffold",
55
+ "create",
56
+ "plugin"
57
+ ],
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "scripts": {
62
+ "build": "vite build && node scripts/generate-types.js && node scripts/copy-templates.js",
63
+ "dev": "vite build --watch"
64
+ }
65
+ }
@@ -0,0 +1,32 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{projectName}}</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
+ line-height: 1.6;
17
+ color: #333;
18
+ background: #f5f5f5;
19
+ }
20
+
21
+ #app {
22
+ max-width: 800px;
23
+ margin: 0 auto;
24
+ padding: 40px 20px;
25
+ }
26
+ </style>
27
+ </head>
28
+ <body>
29
+ <div id="app"></div>
30
+ <script type="module" src="/src/App.tsx"></script>
31
+ </body>
32
+ </html>
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "sigx": "^0.4.1"
13
+ },
14
+ "devDependencies": {
15
+ "@sigx/vite": "^0.4.1",
16
+ "vite": "^8.0.3",
17
+ "typescript": "^5.9.3"
18
+ }
19
+ }
@@ -0,0 +1,35 @@
1
+ import { component, defineApp } from "sigx";
2
+
3
+ const Counter = component(({ signal }) => {
4
+ const state = signal({ count: 0 });
5
+
6
+ return () => (
7
+ <div style="text-align: center; padding: 40px;">
8
+ <h1 style="color: #2c3e50; margin-bottom: 20px;">
9
+ 🚀 Welcome to sigx!
10
+ </h1>
11
+ <p style="color: #666; margin-bottom: 30px;">
12
+ Edit <code>src/App.tsx</code> to get started
13
+ </p>
14
+ <div style="background: white; padding: 30px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
15
+ <p style="font-size: 48px; margin-bottom: 20px;">
16
+ {state.count}
17
+ </p>
18
+ <button
19
+ onClick={() => state.count++}
20
+ style="padding: 12px 24px; font-size: 16px; background: #3498db; color: white; border: none; border-radius: 6px; cursor: pointer; margin: 0 8px;"
21
+ >
22
+ Increment
23
+ </button>
24
+ <button
25
+ onClick={() => state.count--}
26
+ style="padding: 12px 24px; font-size: 16px; background: #e74c3c; color: white; border: none; border-radius: 6px; cursor: pointer; margin: 0 8px;"
27
+ >
28
+ Decrement
29
+ </button>
30
+ </div>
31
+ </div>
32
+ );
33
+ });
34
+
35
+ defineApp(Counter).mount('#app');
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "jsx": "react-jsx",
5
+ "jsxImportSource": "sigx",
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "strict": true,
9
+ "noEmit": true,
10
+ "skipLibCheck": true
11
+ },
12
+ "include": ["src/**/*.ts", "src/**/*.tsx"]
13
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from 'vite';
2
+ import { sigxPlugin } from '@sigx/vite';
3
+
4
+ export default defineConfig({
5
+ plugins: [
6
+ sigxPlugin()
7
+ ],
8
+ // Vite 8 uses oxc instead of esbuild for JSX transforms
9
+ oxc: {
10
+ jsx: {
11
+ runtime: 'automatic',
12
+ importSource: 'sigx'
13
+ }
14
+ }
15
+ });
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en" data-theme="light">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>{{projectName}}</title>
7
+ <link rel="stylesheet" href="/src/style.css" />
8
+ <script>(function(){try{var t=localStorage.getItem('daisy-theme');if(!t&&window.matchMedia('(prefers-color-scheme:dark)').matches)t='dark';if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})()</script>
9
+ </head>
10
+ <body class="bg-base-200 min-h-screen">
11
+ <div id="app"></div>
12
+ <script type="module" src="/src/App.tsx"></script>
13
+ </body>
14
+ </html>