@flight-framework/cli 0.0.14 → 0.0.16

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 (74) hide show
  1. package/README.md +474 -77
  2. package/dist/bin.js +0 -0
  3. package/dist/bin.js.map +1 -1
  4. package/dist/index.js +0 -0
  5. package/dist/index.js.map +1 -1
  6. package/package.json +53 -53
  7. package/templates/angular/index.html +13 -0
  8. package/templates/angular/package.json.template +25 -0
  9. package/templates/angular/src/app.component.ts +13 -0
  10. package/templates/angular/src/main.server.ts +11 -0
  11. package/templates/angular/src/main.ts +4 -0
  12. package/templates/angular/tsconfig.json +16 -0
  13. package/templates/base/README.md.template +26 -26
  14. package/templates/base/_gitignore +25 -25
  15. package/templates/base/flight.config.ts.template +15 -15
  16. package/templates/base/styles/global.css +58 -58
  17. package/templates/htmx/index.html +18 -18
  18. package/templates/htmx/package.json.template +18 -18
  19. package/templates/htmx/vite.config.ts +6 -6
  20. package/templates/lit/index.html +14 -14
  21. package/templates/lit/package.json.template +21 -21
  22. package/templates/lit/src/app-root.ts +18 -18
  23. package/templates/lit/src/entry-client.ts +5 -5
  24. package/templates/lit/src/entry-server.ts +9 -9
  25. package/templates/lit/tsconfig.json +18 -18
  26. package/templates/lit/vite.config.ts +6 -6
  27. package/templates/preact/index.html +14 -14
  28. package/templates/preact/package.json.template +22 -22
  29. package/templates/preact/src/App.tsx +8 -8
  30. package/templates/preact/src/entry-client.tsx +11 -11
  31. package/templates/preact/src/entry-server.tsx +6 -6
  32. package/templates/preact/tsconfig.json +18 -18
  33. package/templates/preact/vite.config.ts +8 -8
  34. package/templates/qwik/index.html +14 -14
  35. package/templates/qwik/package.json.template +20 -20
  36. package/templates/qwik/src/App.tsx +10 -10
  37. package/templates/qwik/src/entry-client.tsx +4 -4
  38. package/templates/qwik/src/entry-server.tsx +9 -9
  39. package/templates/qwik/tsconfig.json +18 -18
  40. package/templates/qwik/vite.config.ts +8 -8
  41. package/templates/react/index.html +13 -13
  42. package/templates/react/package.json.template +24 -24
  43. package/templates/react/src/App.tsx +13 -13
  44. package/templates/react/src/context/RouterContext.tsx +63 -63
  45. package/templates/react/src/entry-client.tsx +19 -19
  46. package/templates/react/src/entry-server.tsx +17 -17
  47. package/templates/react/tsconfig.json +19 -19
  48. package/templates/react/vite.config.ts +12 -12
  49. package/templates/solid/index.html +14 -14
  50. package/templates/solid/package.json.template +21 -21
  51. package/templates/solid/src/App.tsx +8 -8
  52. package/templates/solid/src/entry-client.tsx +11 -11
  53. package/templates/solid/src/entry-server.tsx +6 -6
  54. package/templates/solid/tsconfig.json +18 -18
  55. package/templates/solid/vite.config.ts +8 -8
  56. package/templates/svelte/index.html +14 -14
  57. package/templates/svelte/package.json.template +21 -21
  58. package/templates/svelte/src/App.svelte +4 -4
  59. package/templates/svelte/src/entry-client.ts +7 -7
  60. package/templates/svelte/src/entry-server.ts +7 -7
  61. package/templates/svelte/tsconfig.json +17 -17
  62. package/templates/svelte/vite.config.ts +8 -8
  63. package/templates/vanilla/index.html +14 -14
  64. package/templates/vanilla/package.json.template +19 -19
  65. package/templates/vanilla/src/main.ts +10 -10
  66. package/templates/vanilla/tsconfig.json +16 -16
  67. package/templates/vanilla/vite.config.ts +6 -6
  68. package/templates/vue/index.html +14 -14
  69. package/templates/vue/package.json.template +21 -21
  70. package/templates/vue/src/App.vue +6 -6
  71. package/templates/vue/src/entry-client.ts +12 -12
  72. package/templates/vue/src/entry-server.ts +8 -8
  73. package/templates/vue/tsconfig.json +17 -17
  74. package/templates/vue/vite.config.ts +8 -8
package/README.md CHANGED
@@ -1,77 +1,474 @@
1
- # @flight-framework/cli
2
-
3
- Command-line interface for Flight Framework.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install -g @flight-framework/cli
9
- ```
10
-
11
- Or use via npx:
12
-
13
- ```bash
14
- npx @flight-framework/cli <command>
15
- ```
16
-
17
- ## Commands
18
-
19
- ### create
20
-
21
- Create a new Flight project.
22
-
23
- ```bash
24
- flight create [project-name]
25
- ```
26
-
27
- Options:
28
-
29
- | Option | Description |
30
- |--------|-------------|
31
- | `--ui <framework>` | UI framework: react, vue, svelte, solid, preact, qwik, lit, htmx |
32
- | `--typescript` | Use TypeScript (default) |
33
- | `--no-typescript` | Use JavaScript |
34
-
35
- ### dev
36
-
37
- Start the development server.
38
-
39
- ```bash
40
- flight dev
41
- ```
42
-
43
- Options:
44
-
45
- | Option | Description | Default |
46
- |--------|-------------|---------|
47
- | `-p, --port` | Port number | `5173` |
48
- | `-h, --host` | Host to bind | `localhost` |
49
- | `--open` | Open browser | `false` |
50
- | `--ssr` | Enable SSR | From config |
51
-
52
- ### build
53
-
54
- Build for production.
55
-
56
- ```bash
57
- flight build
58
- ```
59
-
60
- ### start
61
-
62
- Start the production server.
63
-
64
- ```bash
65
- flight start
66
- ```
67
-
68
- Options:
69
-
70
- | Option | Description | Default |
71
- |--------|-------------|---------|
72
- | `-p, --port` | Port number | `3000` |
73
- | `-h, --host` | Host to bind | `0.0.0.0` |
74
-
75
- ## License
76
-
77
- MIT
1
+ # @flight-framework/cli
2
+
3
+ The command-line interface for Flight Framework. Create, develop, build, and deploy full-stack applications with a single tool.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [Creating a Project](#creating-a-project)
9
+ - [Development](#development)
10
+ - [Building for Production](#building-for-production)
11
+ - [Running in Production](#running-in-production)
12
+ - [Generate Commands](#generate-commands)
13
+ - [Configuration](#configuration)
14
+ - [Environment Variables](#environment-variables)
15
+ - [All Commands Reference](#all-commands-reference)
16
+ - [Troubleshooting](#troubleshooting)
17
+ - [License](#license)
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ### Global Installation (Recommended)
24
+
25
+ ```bash
26
+ npm install -g @flight-framework/cli
27
+ ```
28
+
29
+ After installation, the `flight` command is available globally:
30
+
31
+ ```bash
32
+ flight --version
33
+ flight --help
34
+ ```
35
+
36
+ ### Using npx (No Installation)
37
+
38
+ Run commands without installing:
39
+
40
+ ```bash
41
+ npx @flight-framework/cli create my-app
42
+ npx @flight-framework/cli dev
43
+ ```
44
+
45
+ ### Using pnpm or yarn
46
+
47
+ ```bash
48
+ pnpm add -g @flight-framework/cli
49
+ # or
50
+ yarn global add @flight-framework/cli
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Creating a Project
56
+
57
+ ### Interactive Mode
58
+
59
+ Run `create` without arguments for the interactive wizard:
60
+
61
+ ```bash
62
+ flight create
63
+ ```
64
+
65
+ The wizard guides you through:
66
+ 1. Project name
67
+ 2. UI framework selection
68
+ 3. TypeScript or JavaScript
69
+ 4. Additional features (forms, auth, i18n, etc.)
70
+
71
+ ### Quick Start
72
+
73
+ Create a project with defaults (React + TypeScript):
74
+
75
+ ```bash
76
+ flight create my-app
77
+ cd my-app
78
+ npm install
79
+ flight dev
80
+ ```
81
+
82
+ ### With Options
83
+
84
+ Specify options to skip prompts:
85
+
86
+ ```bash
87
+ # React with TypeScript (default)
88
+ flight create my-app
89
+
90
+ # Vue with TypeScript
91
+ flight create my-app --ui vue
92
+
93
+ # Svelte with JavaScript
94
+ flight create my-app --ui svelte --no-typescript
95
+
96
+ # Solid with all features
97
+ flight create my-app --ui solid --features forms,auth,i18n
98
+ ```
99
+
100
+ ### Available UI Frameworks
101
+
102
+ | Framework | Option | Description |
103
+ |-----------|--------|-------------|
104
+ | React | `--ui react` | Default. Best ecosystem support |
105
+ | Vue | `--ui vue` | Composition API with SFC support |
106
+ | Svelte | `--ui svelte` | Compiler-based, minimal runtime |
107
+ | Solid | `--ui solid` | Fine-grained reactivity |
108
+ | Preact | `--ui preact` | Lightweight React alternative |
109
+ | Qwik | `--ui qwik` | Resumability-first |
110
+ | Lit | `--ui lit` | Web Components |
111
+ | HTMX | `--ui htmx` | HTML-driven interactivity |
112
+
113
+ ### Create Options
114
+
115
+ | Option | Description |
116
+ |--------|-------------|
117
+ | `--ui <framework>` | UI framework to use |
118
+ | `--typescript` | Use TypeScript (default) |
119
+ | `--no-typescript` | Use JavaScript |
120
+ | `--features <list>` | Comma-separated features: forms, auth, i18n, db |
121
+ | `--package-manager <pm>` | npm, pnpm, yarn, or bun |
122
+ | `--git` | Initialize git repository (default: true) |
123
+ | `--no-git` | Skip git initialization |
124
+ | `--install` | Install dependencies (default: true) |
125
+ | `--no-install` | Skip dependency installation |
126
+
127
+ ---
128
+
129
+ ## Development
130
+
131
+ Start the development server with hot module replacement:
132
+
133
+ ```bash
134
+ flight dev
135
+ ```
136
+
137
+ The dev server includes:
138
+ - Hot Module Replacement (HMR)
139
+ - Server-Side Rendering (if enabled)
140
+ - API routes with hot reload
141
+ - TypeScript type checking
142
+ - Error overlay with source maps
143
+
144
+ ### Dev Options
145
+
146
+ | Option | Default | Description |
147
+ |--------|---------|-------------|
148
+ | `-p, --port <number>` | `5173` | Port number |
149
+ | `-h, --host <host>` | `localhost` | Host to bind |
150
+ | `--open` | `false` | Open browser automatically |
151
+ | `--https` | `false` | Enable HTTPS with self-signed cert |
152
+ | `--ssr` | from config | Enable/disable SSR |
153
+ | `--no-ssr` | - | Disable SSR for this session |
154
+ | `--force` | `false` | Force re-optimization of dependencies |
155
+
156
+ ### Examples
157
+
158
+ ```bash
159
+ # Start on port 3000
160
+ flight dev -p 3000
161
+
162
+ # Bind to all interfaces (for network access)
163
+ flight dev --host 0.0.0.0
164
+
165
+ # Open browser and enable HTTPS
166
+ flight dev --open --https
167
+
168
+ # Disable SSR temporarily
169
+ flight dev --no-ssr
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Building for Production
175
+
176
+ Build optimized bundles for production:
177
+
178
+ ```bash
179
+ flight build
180
+ ```
181
+
182
+ The build process:
183
+ 1. Type checks the project
184
+ 2. Bundles client and server code
185
+ 3. Optimizes assets (minification, tree-shaking)
186
+ 4. Generates static pages (if configured)
187
+ 5. Creates deployment artifacts
188
+
189
+ ### Build Options
190
+
191
+ | Option | Default | Description |
192
+ |--------|---------|-------------|
193
+ | `--target <adapter>` | from config | Deployment target |
194
+ | `--analyze` | `false` | Generate bundle analysis |
195
+ | `--sourcemap` | `false` | Include source maps |
196
+ | `--no-minify` | - | Skip minification |
197
+
198
+ ### Deployment Targets
199
+
200
+ ```bash
201
+ # Node.js server (default)
202
+ flight build --target node
203
+
204
+ # Cloudflare Workers
205
+ flight build --target cloudflare
206
+
207
+ # Vercel
208
+ flight build --target vercel
209
+
210
+ # Netlify
211
+ flight build --target netlify
212
+
213
+ # Static site
214
+ flight build --target static
215
+
216
+ # Docker
217
+ flight build --target docker
218
+ ```
219
+
220
+ ### Build Output
221
+
222
+ ```
223
+ dist/
224
+ client/ # Browser bundles
225
+ assets/
226
+ index.html
227
+ server/ # Server code
228
+ index.js
229
+ static/ # Pre-rendered pages
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Running in Production
235
+
236
+ Start the production server:
237
+
238
+ ```bash
239
+ flight start
240
+ ```
241
+
242
+ This runs the optimized build with:
243
+ - Compression enabled
244
+ - Static asset caching
245
+ - Production error handling
246
+ - Health check endpoint at `/_health`
247
+
248
+ ### Start Options
249
+
250
+ | Option | Default | Description |
251
+ |--------|---------|-------------|
252
+ | `-p, --port <number>` | `3000` | Port number |
253
+ | `-h, --host <host>` | `0.0.0.0` | Host to bind |
254
+ | `--cluster` | `false` | Enable cluster mode |
255
+ | `--workers <number>` | CPU cores | Number of workers |
256
+
257
+ ### Examples
258
+
259
+ ```bash
260
+ # Start on port 8080
261
+ flight start -p 8080
262
+
263
+ # Enable cluster mode for multi-core
264
+ flight start --cluster --workers 4
265
+ ```
266
+
267
+ ---
268
+
269
+ ## Generate Commands
270
+
271
+ Scaffold new files with correct structure:
272
+
273
+ ```bash
274
+ flight generate <type> <name>
275
+ # or shorthand
276
+ flight g <type> <name>
277
+ ```
278
+
279
+ ### Available Generators
280
+
281
+ | Type | Alias | Description |
282
+ |------|-------|-------------|
283
+ | `page` | `p` | New page component |
284
+ | `api` | `a` | API route handler |
285
+ | `component` | `c` | UI component |
286
+ | `action` | `act` | Server action |
287
+ | `middleware` | `mw` | Middleware function |
288
+ | `layout` | `l` | Layout component |
289
+
290
+ ### Examples
291
+
292
+ ```bash
293
+ # Generate a page at /dashboard
294
+ flight g page dashboard
295
+
296
+ # Generate an API route at /api/users
297
+ flight g api users
298
+
299
+ # Generate a reusable component
300
+ flight g component Button
301
+
302
+ # Generate a server action
303
+ flight g action submitForm
304
+
305
+ # Generate middleware
306
+ flight g middleware auth
307
+ ```
308
+
309
+ ### Generated Files
310
+
311
+ ```bash
312
+ flight g page dashboard
313
+ # Creates: src/routes/dashboard.page.tsx
314
+
315
+ flight g api users
316
+ # Creates: src/routes/api/users.get.ts
317
+ # src/routes/api/users.post.ts
318
+
319
+ flight g component Button
320
+ # Creates: src/components/Button.tsx
321
+ # src/components/Button.css
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Configuration
327
+
328
+ Flight uses `flight.config.ts` (or `.js`) in the project root:
329
+
330
+ ```typescript
331
+ // flight.config.ts
332
+ import { defineConfig } from '@flight-framework/core';
333
+
334
+ export default defineConfig({
335
+ // Server configuration
336
+ server: {
337
+ port: 3000,
338
+ host: 'localhost',
339
+ },
340
+
341
+ // Rendering options
342
+ render: {
343
+ defaultMode: 'ssr', // 'ssr' | 'ssg' | 'spa'
344
+ streaming: true,
345
+ },
346
+
347
+ // Build options
348
+ build: {
349
+ outDir: 'dist',
350
+ target: 'node', // Deployment target
351
+ minify: true,
352
+ sourcemap: false,
353
+ },
354
+
355
+ // Routes configuration
356
+ routes: {
357
+ directory: 'src/routes',
358
+ },
359
+ });
360
+ ```
361
+
362
+ ---
363
+
364
+ ## Environment Variables
365
+
366
+ Flight automatically loads environment variables:
367
+
368
+ | File | Environment | Priority |
369
+ |------|-------------|---------|
370
+ | `.env` | All | 1 (lowest) |
371
+ | `.env.local` | All | 2 |
372
+ | `.env.development` | Development | 3 |
373
+ | `.env.production` | Production | 3 |
374
+ | `.env.development.local` | Development | 4 (highest) |
375
+ | `.env.production.local` | Production | 4 (highest) |
376
+
377
+ ### Accessing Variables
378
+
379
+ ```typescript
380
+ // Server-side (full access)
381
+ const apiKey = process.env.API_KEY;
382
+
383
+ // Client-side (only PUBLIC_ prefix)
384
+ const publicUrl = process.env.PUBLIC_API_URL;
385
+ ```
386
+
387
+ Only variables prefixed with `PUBLIC_` are exposed to the browser.
388
+
389
+ ---
390
+
391
+ ## All Commands Reference
392
+
393
+ | Command | Description |
394
+ |---------|-------------|
395
+ | `flight create [name]` | Create new project |
396
+ | `flight dev` | Start development server |
397
+ | `flight build` | Build for production |
398
+ | `flight start` | Start production server |
399
+ | `flight generate <type> <name>` | Generate files |
400
+ | `flight typecheck` | Run TypeScript type checking |
401
+ | `flight lint` | Run ESLint |
402
+ | `flight test` | Run tests |
403
+ | `flight preview` | Preview production build locally |
404
+ | `flight upgrade` | Upgrade Flight packages |
405
+ | `flight info` | Display project information |
406
+
407
+ ### Global Options
408
+
409
+ Available on all commands:
410
+
411
+ | Option | Description |
412
+ |--------|-------------|
413
+ | `--help` | Show help |
414
+ | `--version` | Show version |
415
+ | `--config <path>` | Path to config file |
416
+ | `--cwd <path>` | Working directory |
417
+ | `--verbose` | Verbose output |
418
+ | `--quiet` | Minimal output |
419
+
420
+ ---
421
+
422
+ ## Troubleshooting
423
+
424
+ ### Port Already in Use
425
+
426
+ ```bash
427
+ # Use a different port
428
+ flight dev -p 3001
429
+
430
+ # Or kill the process using the port
431
+ npx kill-port 5173
432
+ ```
433
+
434
+ ### TypeScript Errors on Start
435
+
436
+ ```bash
437
+ # Force rebuild of type cache
438
+ flight dev --force
439
+ ```
440
+
441
+ ### Permission Denied (Global Install)
442
+
443
+ ```bash
444
+ # Fix npm permissions
445
+ npm config set prefix ~/.npm-global
446
+ export PATH=~/.npm-global/bin:$PATH
447
+
448
+ # Or use npx instead
449
+ npx @flight-framework/cli dev
450
+ ```
451
+
452
+ ### Slow Dev Server
453
+
454
+ Check for large `node_modules` in the routes directory, or try:
455
+
456
+ ```bash
457
+ # Clear Vite cache
458
+ rm -rf node_modules/.vite
459
+ flight dev
460
+ ```
461
+
462
+ ### Build Fails with Memory Error
463
+
464
+ Increase Node.js memory limit:
465
+
466
+ ```bash
467
+ NODE_OPTIONS="--max-old-space-size=8192" flight build
468
+ ```
469
+
470
+ ---
471
+
472
+ ## License
473
+
474
+ MIT
package/dist/bin.js CHANGED
File without changes