create-forkly 0.1.1 → 0.3.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.
package/dist/index.js CHANGED
@@ -69,5 +69,5 @@ cli.command('[dir]', 'Create a new Forkly project')
69
69
  p.outro(`Done! Run:\n cd ${projectName}\n npm run dev`);
70
70
  });
71
71
  cli.help();
72
- cli.version('0.1.1');
72
+ cli.version('0.2.0');
73
73
  cli.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-forkly",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "CLI to scaffold a new Forkly project",
5
5
  "type": "module",
6
6
  "bin": {
package/template/app.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** Forkly 应用入口 — 启动 App 并注册钩子与定时任务 */
2
- import { App } from 'forkly';
2
+ import { Forkly } from 'forkly';
3
3
 
4
- const app = new App({
4
+ const app = new Forkly({
5
5
  port: 3000,
6
6
  workers: 4,
7
7
  });
@@ -3,5 +3,6 @@
3
3
  "workers": 4,
4
4
  "session": { "secret": "your-secret-key-change-me", "maxAge": 86400000 },
5
5
  "errorFormat": "json",
6
- "logger": { "level": "info" }
6
+ "logger": { "level": "info" },
7
+ "monitor": { "enabled": false, "port": 9031 }
7
8
  }
@@ -7,7 +7,7 @@
7
7
  "build": "tsc"
8
8
  },
9
9
  "dependencies": {
10
- "forkly": "^0.2.0"
10
+ "forkly": "^0.4.0"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "^25.9.1",
@@ -7,7 +7,7 @@ export class IndexRouter extends Router {
7
7
  async get() {
8
8
  return {
9
9
  message: 'Welcome to Forkly!',
10
- version: '0.1.0',
10
+ version: '0.4.0',
11
11
  timestamp: Date.now(),
12
12
  };
13
13
  }
@@ -1,22 +1,249 @@
1
1
  <!DOCTYPE html>
2
- <html lang="zh">
2
+ <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Forkly App</title>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Forkly</title>
7
7
  <style>
8
- body { font-family: system-ui, sans-serif; max-width: 640px; margin: 80px auto; padding: 0 20px; color: #333; }
9
- h1 { font-size: 2rem; margin-bottom: 0.5rem; }
10
- code { background: #f4f4f4; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
11
- .card { border: 1px solid #e0e0e0; border-radius: 8px; padding: 20px; margin: 16px 0; }
8
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
9
+
10
+ :root {
11
+ --bg: #0a0a0f;
12
+ --surface: #12121a;
13
+ --border: #1e1e2e;
14
+ --text: #e0e0f0;
15
+ --muted: #6c6c8a;
16
+ --accent: #7c5cfc;
17
+ --accent-glow: rgba(124, 92, 252, 0.25);
18
+ --green: #4ade80;
19
+ --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
20
+ }
21
+
22
+ body {
23
+ background: var(--bg);
24
+ color: var(--text);
25
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
26
+ min-height: 100vh;
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: center;
30
+ justify-content: center;
31
+ overflow-x: hidden;
32
+ }
33
+
34
+ body::before {
35
+ content: '';
36
+ position: fixed;
37
+ top: -40%;
38
+ left: -20%;
39
+ width: 140%;
40
+ height: 140%;
41
+ background: radial-gradient(ellipse at 30% 50%, rgba(124, 92, 252, 0.06) 0%, transparent 60%),
42
+ radial-gradient(ellipse at 70% 50%, rgba(74, 222, 128, 0.04) 0%, transparent 60%);
43
+ pointer-events: none;
44
+ z-index: 0;
45
+ }
46
+
47
+ main {
48
+ position: relative;
49
+ z-index: 1;
50
+ text-align: center;
51
+ padding: 2rem;
52
+ }
53
+
54
+ .logo {
55
+ display: inline-flex;
56
+ align-items: center;
57
+ gap: 12px;
58
+ margin-bottom: 0.75rem;
59
+ }
60
+
61
+ .logo svg {
62
+ width: 48px;
63
+ height: 48px;
64
+ filter: drop-shadow(0 0 24px var(--accent-glow));
65
+ }
66
+
67
+ h1 {
68
+ font-size: 3.5rem;
69
+ font-weight: 800;
70
+ letter-spacing: -0.03em;
71
+ background: linear-gradient(135deg, #c4b5fd 0%, var(--accent) 40%, #a78bfa 100%);
72
+ -webkit-background-clip: text;
73
+ -webkit-text-fill-color: transparent;
74
+ background-clip: text;
75
+ line-height: 1.15;
76
+ }
77
+
78
+ .tagline {
79
+ color: var(--muted);
80
+ font-size: 1.1rem;
81
+ margin-top: 0.5rem;
82
+ font-weight: 400;
83
+ letter-spacing: 0.01em;
84
+ }
85
+
86
+ .status {
87
+ display: inline-flex;
88
+ align-items: center;
89
+ gap: 8px;
90
+ margin-top: 2rem;
91
+ padding: 10px 22px;
92
+ background: var(--surface);
93
+ border: 1px solid var(--border);
94
+ border-radius: 999px;
95
+ font-size: 0.9rem;
96
+ color: var(--muted);
97
+ }
98
+
99
+ .status-dot {
100
+ width: 8px;
101
+ height: 8px;
102
+ border-radius: 50%;
103
+ background: var(--green);
104
+ box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
105
+ animation: pulse-dot 2s ease-in-out infinite;
106
+ }
107
+
108
+ @keyframes pulse-dot {
109
+ 0%, 100% { opacity: 1; }
110
+ 50% { opacity: 0.45; }
111
+ }
112
+
113
+ .endpoints {
114
+ display: flex;
115
+ flex-wrap: wrap;
116
+ gap: 12px;
117
+ justify-content: center;
118
+ margin-top: 2.5rem;
119
+ }
120
+
121
+ .endpoint-card {
122
+ background: var(--surface);
123
+ border: 1px solid var(--border);
124
+ border-radius: 12px;
125
+ padding: 16px 24px;
126
+ min-width: 200px;
127
+ text-align: left;
128
+ transition: border-color 0.2s, box-shadow 0.2s;
129
+ }
130
+
131
+ .endpoint-card:hover {
132
+ border-color: var(--accent);
133
+ box-shadow: 0 0 20px var(--accent-glow);
134
+ }
135
+
136
+ .endpoint-card .method {
137
+ font-family: var(--font-mono);
138
+ font-size: 0.75rem;
139
+ font-weight: 700;
140
+ text-transform: uppercase;
141
+ letter-spacing: 0.08em;
142
+ color: var(--green);
143
+ margin-bottom: 6px;
144
+ }
145
+
146
+ .endpoint-card .path {
147
+ font-family: var(--font-mono);
148
+ font-size: 0.95rem;
149
+ color: var(--text);
150
+ word-break: break-all;
151
+ }
152
+
153
+ .endpoint-card .desc {
154
+ font-size: 0.8rem;
155
+ color: var(--muted);
156
+ margin-top: 4px;
157
+ }
158
+
159
+ .quickstart {
160
+ margin-top: 3.5rem;
161
+ background: var(--surface);
162
+ border: 1px solid var(--border);
163
+ border-radius: 12px;
164
+ padding: 20px 28px;
165
+ display: inline-block;
166
+ }
167
+
168
+ .quickstart code {
169
+ font-family: var(--font-mono);
170
+ font-size: 0.9rem;
171
+ background: transparent;
172
+ color: #e0e0f0;
173
+ }
174
+
175
+ .quickstart .cmd {
176
+ color: var(--accent);
177
+ font-weight: 600;
178
+ }
179
+
180
+ .quickstart .arg {
181
+ color: var(--green);
182
+ }
183
+
184
+ footer {
185
+ margin-top: 3rem;
186
+ color: var(--muted);
187
+ font-size: 0.8rem;
188
+ position: relative;
189
+ z-index: 1;
190
+ }
191
+
192
+ footer a {
193
+ color: var(--accent);
194
+ text-decoration: none;
195
+ }
12
196
  </style>
13
197
  </head>
14
198
  <body>
15
- <h1>Forkly</h1>
16
- <p>A multi-process Node.js backend framework — minimal, fast, production-ready.</p>
17
- <div class="card">
18
- <p>Visit <code>/hello?name=forkly</code> to try the API</p>
19
- <p>Visit <code>/users/1</code> to try dynamic routing</p>
20
- </div>
199
+ <main>
200
+ <div class="logo">
201
+ <svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
202
+ <rect x="4" y="8" width="16" height="32" rx="4" fill="#7c5cfc" opacity="0.9"/>
203
+ <rect x="24" y="4" width="16" height="40" rx="4" fill="#7c5cfc" opacity="0.85"/>
204
+ <rect x="12" y="16" width="8" height="8" rx="2" fill="#0a0a0f" opacity="0.5"/>
205
+ <rect x="32" y="12" width="8" height="8" rx="2" fill="#0a0a0f" opacity="0.5"/>
206
+ <rect x="16" y="32" width="6" height="4" rx="1" fill="#4ade80" opacity="0.7"/>
207
+ <rect x="36" y="30" width="6" height="8" rx="1" fill="#4ade80" opacity="0.7"/>
208
+ </svg>
209
+ <h1>Forkly</h1>
210
+ </div>
211
+
212
+ <p class="tagline">Multi-process Node.js framework — zero deps, zero fuss.</p>
213
+
214
+ <div class="status">
215
+ <span class="status-dot"></span>
216
+ <span>Server is running</span>
217
+ </div>
218
+
219
+ <div class="endpoints">
220
+ <div class="endpoint-card">
221
+ <div class="method">GET</div>
222
+ <div class="path">/api/hello</div>
223
+ <div class="desc">Health check endpoint</div>
224
+ </div>
225
+ <div class="endpoint-card">
226
+ <div class="method">ANY</div>
227
+ <div class="path">/user/:id</div>
228
+ <div class="desc">File-system route</div>
229
+ </div>
230
+ <div class="endpoint-card">
231
+ <div class="method">STATIC</div>
232
+ <div class="path">/public/*</div>
233
+ <div class="desc">Static file serving</div>
234
+ </div>
235
+ </div>
236
+
237
+ <div class="quickstart">
238
+ <code>
239
+ <span class="cmd">npx create-forkly</span>
240
+ &nbsp;<span class="arg">my-app</span>
241
+ </code>
242
+ </div>
243
+ </main>
244
+
245
+ <footer>
246
+ Built with Forkly — zero runtime dependencies
247
+ </footer>
21
248
  </body>
22
249
  </html>