create-fluxstack 1.0.1 → 1.0.2
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/create-fluxstack.ts +2 -3
- package/package.json +1 -1
- package/.env +0 -30
- package/LICENSE +0 -21
- package/app/client/README.md +0 -69
- package/app/client/frontend-only.ts +0 -12
- package/app/client/index.html +0 -13
- package/app/client/public/vite.svg +0 -1
- package/app/client/src/App.css +0 -883
- package/app/client/src/App.tsx +0 -669
- package/app/client/src/assets/react.svg +0 -1
- package/app/client/src/components/TestPage.tsx +0 -453
- package/app/client/src/index.css +0 -51
- package/app/client/src/lib/eden-api.ts +0 -110
- package/app/client/src/main.tsx +0 -10
- package/app/client/src/vite-env.d.ts +0 -1
- package/app/client/tsconfig.app.json +0 -43
- package/app/client/tsconfig.json +0 -7
- package/app/client/tsconfig.node.json +0 -25
- package/app/server/app.ts +0 -10
- package/app/server/backend-only.ts +0 -15
- package/app/server/controllers/users.controller.ts +0 -69
- package/app/server/index.ts +0 -104
- package/app/server/routes/index.ts +0 -25
- package/app/server/routes/users.routes.ts +0 -121
- package/app/server/types/index.ts +0 -1
- package/app/shared/types/index.ts +0 -18
- package/bun.lock +0 -1053
- package/core/__tests__/integration.test.ts +0 -227
- package/core/build/index.ts +0 -186
- package/core/cli/command-registry.ts +0 -334
- package/core/cli/index.ts +0 -394
- package/core/cli/plugin-discovery.ts +0 -200
- package/core/client/standalone.ts +0 -57
- package/core/config/__tests__/config-loader.test.ts +0 -591
- package/core/config/__tests__/config-merger.test.ts +0 -657
- package/core/config/__tests__/env-converter.test.ts +0 -372
- package/core/config/__tests__/env-processor.test.ts +0 -431
- package/core/config/__tests__/env.test.ts +0 -452
- package/core/config/__tests__/integration.test.ts +0 -418
- package/core/config/__tests__/loader.test.ts +0 -331
- package/core/config/__tests__/schema.test.ts +0 -129
- package/core/config/__tests__/validator.test.ts +0 -318
- package/core/config/env-dynamic.ts +0 -326
- package/core/config/env.ts +0 -597
- package/core/config/index.ts +0 -317
- package/core/config/loader.ts +0 -546
- package/core/config/runtime-config.ts +0 -322
- package/core/config/schema.ts +0 -694
- package/core/config/validator.ts +0 -540
- package/core/framework/__tests__/server.test.ts +0 -233
- package/core/framework/client.ts +0 -132
- package/core/framework/index.ts +0 -8
- package/core/framework/server.ts +0 -501
- package/core/framework/types.ts +0 -63
- package/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
- package/core/plugins/__tests__/manager.test.ts +0 -398
- package/core/plugins/__tests__/monitoring.test.ts +0 -401
- package/core/plugins/__tests__/registry.test.ts +0 -335
- package/core/plugins/built-in/index.ts +0 -142
- package/core/plugins/built-in/logger/index.ts +0 -180
- package/core/plugins/built-in/monitoring/README.md +0 -193
- package/core/plugins/built-in/monitoring/index.ts +0 -912
- package/core/plugins/built-in/static/index.ts +0 -289
- package/core/plugins/built-in/swagger/index.ts +0 -229
- package/core/plugins/built-in/vite/index.ts +0 -316
- package/core/plugins/config.ts +0 -348
- package/core/plugins/discovery.ts +0 -350
- package/core/plugins/executor.ts +0 -351
- package/core/plugins/index.ts +0 -195
- package/core/plugins/manager.ts +0 -583
- package/core/plugins/registry.ts +0 -424
- package/core/plugins/types.ts +0 -254
- package/core/server/framework.ts +0 -123
- package/core/server/index.ts +0 -8
- package/core/server/plugins/database.ts +0 -182
- package/core/server/plugins/logger.ts +0 -47
- package/core/server/plugins/swagger.ts +0 -34
- package/core/server/standalone.ts +0 -91
- package/core/templates/create-project.ts +0 -455
- package/core/types/api.ts +0 -169
- package/core/types/build.ts +0 -174
- package/core/types/config.ts +0 -68
- package/core/types/index.ts +0 -127
- package/core/types/plugin.ts +0 -94
- package/core/utils/__tests__/errors.test.ts +0 -139
- package/core/utils/__tests__/helpers.test.ts +0 -297
- package/core/utils/__tests__/logger.test.ts +0 -141
- package/core/utils/env-runtime-v2.ts +0 -232
- package/core/utils/env-runtime.ts +0 -252
- package/core/utils/errors/codes.ts +0 -115
- package/core/utils/errors/handlers.ts +0 -63
- package/core/utils/errors/index.ts +0 -81
- package/core/utils/helpers.ts +0 -180
- package/core/utils/index.ts +0 -18
- package/core/utils/logger/index.ts +0 -161
- package/core/utils/logger.ts +0 -106
- package/core/utils/monitoring/index.ts +0 -212
- package/tsconfig.json +0 -51
- package/vite.config.ts +0 -42
|
@@ -1,455 +0,0 @@
|
|
|
1
|
-
import { spawn } from "bun"
|
|
2
|
-
import { join, resolve } from "path"
|
|
3
|
-
import { mkdir } from "fs/promises"
|
|
4
|
-
|
|
5
|
-
export interface CreateProjectOptions {
|
|
6
|
-
name: string
|
|
7
|
-
targetDir?: string
|
|
8
|
-
template?: 'basic' | 'full'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class ProjectCreator {
|
|
12
|
-
private projectName: string
|
|
13
|
-
private targetDir: string
|
|
14
|
-
|
|
15
|
-
constructor(options: CreateProjectOptions) {
|
|
16
|
-
this.projectName = options.name
|
|
17
|
-
this.targetDir = options.targetDir || resolve(process.cwd(), options.name)
|
|
18
|
-
// Template option available but basic template is used for now
|
|
19
|
-
// const template = options.template || 'basic'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async create() {
|
|
23
|
-
console.log(`🎉 Creating FluxStack project: ${this.projectName}`)
|
|
24
|
-
console.log(`📁 Target directory: ${this.targetDir}`)
|
|
25
|
-
console.log()
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
// 1. Create project directory
|
|
29
|
-
await this.createDirectory()
|
|
30
|
-
|
|
31
|
-
// 2. Copy template files
|
|
32
|
-
await this.copyTemplate()
|
|
33
|
-
|
|
34
|
-
// 3. Generate package.json
|
|
35
|
-
await this.generatePackageJson()
|
|
36
|
-
|
|
37
|
-
// 4. Generate config files
|
|
38
|
-
await this.generateConfigFiles()
|
|
39
|
-
|
|
40
|
-
// 5. Install dependencies
|
|
41
|
-
await this.installDependencies()
|
|
42
|
-
|
|
43
|
-
// 6. Initialize git
|
|
44
|
-
await this.initGit()
|
|
45
|
-
|
|
46
|
-
console.log()
|
|
47
|
-
console.log("🎉 Project created successfully!")
|
|
48
|
-
console.log()
|
|
49
|
-
console.log("Next steps:")
|
|
50
|
-
console.log(` cd ${this.projectName}`)
|
|
51
|
-
console.log(` bun run dev`)
|
|
52
|
-
console.log()
|
|
53
|
-
console.log("Happy coding! 🚀")
|
|
54
|
-
|
|
55
|
-
} catch (error) {
|
|
56
|
-
console.error("❌ Error creating project:", error instanceof Error ? error.message : String(error))
|
|
57
|
-
process.exit(1)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
private async createDirectory() {
|
|
62
|
-
console.log("📁 Creating project directory...")
|
|
63
|
-
await mkdir(this.targetDir, { recursive: true })
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private async copyTemplate() {
|
|
67
|
-
console.log("📋 Copying template files...")
|
|
68
|
-
|
|
69
|
-
// Copy files using Bun's built-in functions for better performance
|
|
70
|
-
const rootDir = join(__dirname, '..', '..')
|
|
71
|
-
|
|
72
|
-
// Copy app structure (exclude node_modules and dist)
|
|
73
|
-
await this.copyDirectory(
|
|
74
|
-
join(rootDir, 'app'),
|
|
75
|
-
join(this.targetDir, 'app'),
|
|
76
|
-
['node_modules', 'dist', '.vite']
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
// Copy core framework (exclude node_modules)
|
|
80
|
-
await this.copyDirectory(
|
|
81
|
-
join(rootDir, 'core'),
|
|
82
|
-
join(this.targetDir, 'core'),
|
|
83
|
-
['node_modules']
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
// Copy config
|
|
87
|
-
await this.copyDirectory(
|
|
88
|
-
join(rootDir, 'config'),
|
|
89
|
-
join(this.targetDir, 'config')
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private async copyDirectory(src: string, dest: string, exclude: string[] = []) {
|
|
94
|
-
await mkdir(dest, { recursive: true })
|
|
95
|
-
|
|
96
|
-
const entries = await Bun.file(src).exists() ?
|
|
97
|
-
await (await import("fs/promises")).readdir(src, { withFileTypes: true }) : []
|
|
98
|
-
|
|
99
|
-
for (const entry of entries) {
|
|
100
|
-
if (exclude.includes(entry.name)) continue
|
|
101
|
-
|
|
102
|
-
const srcPath = join(src, entry.name)
|
|
103
|
-
const destPath = join(dest, entry.name)
|
|
104
|
-
|
|
105
|
-
if (entry.isDirectory()) {
|
|
106
|
-
await this.copyDirectory(srcPath, destPath, exclude)
|
|
107
|
-
} else {
|
|
108
|
-
const content = await Bun.file(srcPath).text()
|
|
109
|
-
await Bun.write(destPath, content)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
private async generatePackageJson() {
|
|
115
|
-
console.log("📦 Generating package.json...")
|
|
116
|
-
|
|
117
|
-
const packageJson = {
|
|
118
|
-
name: this.projectName,
|
|
119
|
-
version: "1.0.0",
|
|
120
|
-
description: `FluxStack project: ${this.projectName}`,
|
|
121
|
-
keywords: ["fluxstack", "full-stack", "typescript", "elysia", "react", "bun"],
|
|
122
|
-
author: "FluxStack Developer",
|
|
123
|
-
license: "MIT",
|
|
124
|
-
module: "app/server/index.ts",
|
|
125
|
-
type: "module",
|
|
126
|
-
bin: {
|
|
127
|
-
flux: "./core/cli/index.ts"
|
|
128
|
-
},
|
|
129
|
-
scripts: {
|
|
130
|
-
dev: "bun run core/cli/index.ts dev",
|
|
131
|
-
"dev:frontend": "bun run core/cli/index.ts frontend",
|
|
132
|
-
"dev:backend": "bun run core/cli/index.ts backend",
|
|
133
|
-
build: "bun run core/cli/index.ts build",
|
|
134
|
-
"build:frontend": "bun run core/cli/index.ts build:frontend",
|
|
135
|
-
"build:backend": "bun run core/cli/index.ts build:backend",
|
|
136
|
-
start: "bun run core/cli/index.ts start",
|
|
137
|
-
test: "vitest",
|
|
138
|
-
"test:ui": "vitest --ui",
|
|
139
|
-
"test:run": "vitest run",
|
|
140
|
-
"test:coverage": "vitest run --coverage",
|
|
141
|
-
"test:watch": "vitest --watch"
|
|
142
|
-
},
|
|
143
|
-
devDependencies: {
|
|
144
|
-
"@types/bun": "latest",
|
|
145
|
-
"@types/react": "^18.2.0",
|
|
146
|
-
"@types/react-dom": "^18.2.0",
|
|
147
|
-
"@testing-library/react": "^14.0.0",
|
|
148
|
-
"@testing-library/jest-dom": "^6.1.0",
|
|
149
|
-
"@testing-library/user-event": "^14.5.0",
|
|
150
|
-
"@vitest/ui": "^1.0.0",
|
|
151
|
-
"@vitest/coverage-v8": "^1.0.0",
|
|
152
|
-
"jsdom": "^23.0.0",
|
|
153
|
-
typescript: "^5.0.0",
|
|
154
|
-
vitest: "^1.0.0"
|
|
155
|
-
},
|
|
156
|
-
dependencies: {
|
|
157
|
-
"@elysiajs/eden": "^1.3.2",
|
|
158
|
-
"@vitejs/plugin-react": "^4.0.0",
|
|
159
|
-
elysia: "latest",
|
|
160
|
-
react: "^18.2.0",
|
|
161
|
-
"react-dom": "^18.2.0",
|
|
162
|
-
vite: "^5.0.0"
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
await Bun.write(
|
|
167
|
-
join(this.targetDir, "package.json"),
|
|
168
|
-
JSON.stringify(packageJson, null, 2)
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
private async generateConfigFiles() {
|
|
173
|
-
console.log("⚙️ Generating config files...")
|
|
174
|
-
|
|
175
|
-
// TypeScript config
|
|
176
|
-
const tsConfig = {
|
|
177
|
-
compilerOptions: {
|
|
178
|
-
lib: ["ESNext", "DOM"],
|
|
179
|
-
target: "ESNext",
|
|
180
|
-
module: "ESNext",
|
|
181
|
-
moduleDetection: "force",
|
|
182
|
-
jsx: "react-jsx",
|
|
183
|
-
allowJs: true,
|
|
184
|
-
moduleResolution: "bundler",
|
|
185
|
-
allowImportingTsExtensions: true,
|
|
186
|
-
verbatimModuleSyntax: true,
|
|
187
|
-
noEmit: true,
|
|
188
|
-
baseUrl: ".",
|
|
189
|
-
paths: {
|
|
190
|
-
"@/*": ["./*"],
|
|
191
|
-
"@/core/*": ["./core/*"],
|
|
192
|
-
"@/app/*": ["./app/*"],
|
|
193
|
-
"@/config/*": ["./config/*"],
|
|
194
|
-
"@/shared/*": ["./app/shared/*"]
|
|
195
|
-
},
|
|
196
|
-
strict: true,
|
|
197
|
-
skipLibCheck: true,
|
|
198
|
-
noFallthroughCasesInSwitch: true,
|
|
199
|
-
noUnusedLocals: false,
|
|
200
|
-
noUnusedParameters: false,
|
|
201
|
-
noPropertyAccessFromIndexSignature: false
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
await Bun.write(
|
|
206
|
-
join(this.targetDir, "tsconfig.json"),
|
|
207
|
-
JSON.stringify(tsConfig, null, 2)
|
|
208
|
-
)
|
|
209
|
-
|
|
210
|
-
// Bun config
|
|
211
|
-
const bunConfig = `# FluxStack Bun Configuration
|
|
212
|
-
[build]
|
|
213
|
-
target = "bun"
|
|
214
|
-
|
|
215
|
-
[install]
|
|
216
|
-
cache = true
|
|
217
|
-
lockfile = true
|
|
218
|
-
|
|
219
|
-
# Path mapping (alias support)
|
|
220
|
-
[build.alias]
|
|
221
|
-
"@" = "."
|
|
222
|
-
"@/core" = "./core"
|
|
223
|
-
"@/app" = "./app"
|
|
224
|
-
"@/config" = "./config"
|
|
225
|
-
"@/shared" = "./app/shared"
|
|
226
|
-
`
|
|
227
|
-
|
|
228
|
-
await Bun.write(join(this.targetDir, "bunfig.toml"), bunConfig)
|
|
229
|
-
|
|
230
|
-
// Environment file
|
|
231
|
-
const envContent = `# FluxStack Environment Variables
|
|
232
|
-
|
|
233
|
-
# Development Mode
|
|
234
|
-
NODE_ENV=development
|
|
235
|
-
|
|
236
|
-
# Server Configuration
|
|
237
|
-
PORT=3000
|
|
238
|
-
HOST=localhost
|
|
239
|
-
|
|
240
|
-
# Frontend Configuration
|
|
241
|
-
FRONTEND_PORT=5173
|
|
242
|
-
VITE_API_URL=http://localhost:3000
|
|
243
|
-
|
|
244
|
-
# Backend Configuration
|
|
245
|
-
BACKEND_PORT=3001
|
|
246
|
-
API_URL=http://localhost:3001
|
|
247
|
-
|
|
248
|
-
# CORS Configuration
|
|
249
|
-
CORS_ORIGINS=http://localhost:3000,http://localhost:5173
|
|
250
|
-
CORS_METHODS=GET,POST,PUT,DELETE,OPTIONS
|
|
251
|
-
CORS_HEADERS=Content-Type,Authorization
|
|
252
|
-
|
|
253
|
-
# Logging
|
|
254
|
-
LOG_LEVEL=info
|
|
255
|
-
|
|
256
|
-
# Build Configuration
|
|
257
|
-
BUILD_TARGET=bun
|
|
258
|
-
BUILD_OUTDIR=dist
|
|
259
|
-
|
|
260
|
-
# Database (optional - uncomment to use)
|
|
261
|
-
# DATABASE_URL=postgresql://user:password@localhost:5432/${this.projectName}
|
|
262
|
-
# DATABASE_HOST=localhost
|
|
263
|
-
# DATABASE_PORT=5432
|
|
264
|
-
# DATABASE_NAME=${this.projectName}
|
|
265
|
-
# DATABASE_USER=user
|
|
266
|
-
# DATABASE_PASSWORD=password
|
|
267
|
-
|
|
268
|
-
# Authentication (optional - uncomment to use)
|
|
269
|
-
# JWT_SECRET=your-super-secret-jwt-key-here
|
|
270
|
-
# JWT_EXPIRES_IN=24h
|
|
271
|
-
|
|
272
|
-
# External APIs (optional - uncomment to use)
|
|
273
|
-
# STRIPE_SECRET_KEY=sk_test_...
|
|
274
|
-
# STRIPE_PUBLISHABLE_KEY=pk_test_...
|
|
275
|
-
|
|
276
|
-
# Email Service (optional - uncomment to use)
|
|
277
|
-
# SMTP_HOST=smtp.gmail.com
|
|
278
|
-
# SMTP_PORT=587
|
|
279
|
-
# SMTP_USER=your-email@gmail.com
|
|
280
|
-
# SMTP_PASS=your-app-password
|
|
281
|
-
|
|
282
|
-
# File Upload (optional - uncomment to use)
|
|
283
|
-
# UPLOAD_PATH=uploads
|
|
284
|
-
# MAX_FILE_SIZE=10485760
|
|
285
|
-
`
|
|
286
|
-
|
|
287
|
-
await Bun.write(join(this.targetDir, ".env"), envContent)
|
|
288
|
-
|
|
289
|
-
// README
|
|
290
|
-
const readme = `# ${this.projectName}
|
|
291
|
-
|
|
292
|
-
Modern full-stack TypeScript application built with FluxStack framework.
|
|
293
|
-
|
|
294
|
-
## Tech Stack
|
|
295
|
-
|
|
296
|
-
- **Backend**: Elysia.js (high-performance web framework)
|
|
297
|
-
- **Frontend**: React + Vite (modern development experience)
|
|
298
|
-
- **Runtime**: Bun (ultra-fast JavaScript runtime)
|
|
299
|
-
- **Type Safety**: Eden Treaty (end-to-end type safety)
|
|
300
|
-
|
|
301
|
-
## Getting Started
|
|
302
|
-
|
|
303
|
-
### Install Dependencies
|
|
304
|
-
\`\`\`bash
|
|
305
|
-
bun install
|
|
306
|
-
\`\`\`
|
|
307
|
-
|
|
308
|
-
### Development
|
|
309
|
-
|
|
310
|
-
#### Full-Stack (Recommended)
|
|
311
|
-
\`\`\`bash
|
|
312
|
-
bun run dev
|
|
313
|
-
# Frontend + Backend integrated at http://localhost:3000
|
|
314
|
-
\`\`\`
|
|
315
|
-
|
|
316
|
-
#### Separate Development
|
|
317
|
-
\`\`\`bash
|
|
318
|
-
# Terminal 1: Backend API
|
|
319
|
-
bun run dev:backend
|
|
320
|
-
# API at http://localhost:3001
|
|
321
|
-
|
|
322
|
-
# Terminal 2: Frontend
|
|
323
|
-
bun run dev:frontend
|
|
324
|
-
# Frontend at http://localhost:5173
|
|
325
|
-
\`\`\`
|
|
326
|
-
|
|
327
|
-
### Production
|
|
328
|
-
|
|
329
|
-
\`\`\`bash
|
|
330
|
-
# Build everything
|
|
331
|
-
bun run build
|
|
332
|
-
|
|
333
|
-
# Start production server
|
|
334
|
-
bun run start
|
|
335
|
-
\`\`\`
|
|
336
|
-
|
|
337
|
-
## Project Structure
|
|
338
|
-
|
|
339
|
-
\`\`\`
|
|
340
|
-
${this.projectName}/
|
|
341
|
-
├── app/ # Your application code
|
|
342
|
-
│ ├── server/ # Backend (controllers, routes)
|
|
343
|
-
│ ├── client/ # Frontend (React components)
|
|
344
|
-
│ └── shared/ # Shared types
|
|
345
|
-
├── core/ # FluxStack framework (don't edit)
|
|
346
|
-
├── config/ # Configuration files
|
|
347
|
-
└── dist/ # Production build
|
|
348
|
-
\`\`\`
|
|
349
|
-
|
|
350
|
-
## Available Commands
|
|
351
|
-
|
|
352
|
-
- \`bun run dev\` - Full-stack development
|
|
353
|
-
- \`bun run dev:frontend\` - Frontend only
|
|
354
|
-
- \`bun run dev:backend\` - Backend only
|
|
355
|
-
- \`bun run build\` - Build for production
|
|
356
|
-
- \`bun run start\` - Start production server
|
|
357
|
-
|
|
358
|
-
## Health Check
|
|
359
|
-
|
|
360
|
-
\`\`\`bash
|
|
361
|
-
curl http://localhost:3000/api/health
|
|
362
|
-
\`\`\`
|
|
363
|
-
|
|
364
|
-
Built with ❤️ using FluxStack framework.
|
|
365
|
-
`
|
|
366
|
-
|
|
367
|
-
await Bun.write(join(this.targetDir, "README.md"), readme)
|
|
368
|
-
|
|
369
|
-
// .gitignore
|
|
370
|
-
const gitignore = `# Dependencies
|
|
371
|
-
node_modules/
|
|
372
|
-
*.lockb
|
|
373
|
-
|
|
374
|
-
# Build outputs
|
|
375
|
-
dist/
|
|
376
|
-
build/
|
|
377
|
-
.next/
|
|
378
|
-
|
|
379
|
-
# Environment variables
|
|
380
|
-
.env.local
|
|
381
|
-
.env.production
|
|
382
|
-
|
|
383
|
-
# IDE
|
|
384
|
-
.vscode/
|
|
385
|
-
.idea/
|
|
386
|
-
*.swp
|
|
387
|
-
*.swo
|
|
388
|
-
|
|
389
|
-
# OS
|
|
390
|
-
.DS_Store
|
|
391
|
-
Thumbs.db
|
|
392
|
-
|
|
393
|
-
# Logs
|
|
394
|
-
*.log
|
|
395
|
-
logs/
|
|
396
|
-
|
|
397
|
-
# Runtime
|
|
398
|
-
.tmp/
|
|
399
|
-
.cache/
|
|
400
|
-
|
|
401
|
-
# Bun
|
|
402
|
-
bun.lockb
|
|
403
|
-
`
|
|
404
|
-
|
|
405
|
-
await Bun.write(join(this.targetDir, ".gitignore"), gitignore)
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
private async installDependencies() {
|
|
409
|
-
console.log("📦 Installing dependencies...")
|
|
410
|
-
|
|
411
|
-
const installProcess = spawn({
|
|
412
|
-
cmd: ["bun", "install"],
|
|
413
|
-
cwd: this.targetDir,
|
|
414
|
-
stdout: "pipe",
|
|
415
|
-
stderr: "pipe"
|
|
416
|
-
})
|
|
417
|
-
|
|
418
|
-
const exitCode = await installProcess.exited
|
|
419
|
-
|
|
420
|
-
if (exitCode !== 0) {
|
|
421
|
-
throw new Error("Failed to install dependencies")
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
private async initGit() {
|
|
426
|
-
console.log("🔧 Initializing git repository...")
|
|
427
|
-
|
|
428
|
-
const gitInitProcess = spawn({
|
|
429
|
-
cmd: ["git", "init"],
|
|
430
|
-
cwd: this.targetDir,
|
|
431
|
-
stdout: "pipe",
|
|
432
|
-
stderr: "pipe"
|
|
433
|
-
})
|
|
434
|
-
|
|
435
|
-
await gitInitProcess.exited
|
|
436
|
-
|
|
437
|
-
const gitAddProcess = spawn({
|
|
438
|
-
cmd: ["git", "add", "."],
|
|
439
|
-
cwd: this.targetDir,
|
|
440
|
-
stdout: "pipe",
|
|
441
|
-
stderr: "pipe"
|
|
442
|
-
})
|
|
443
|
-
|
|
444
|
-
await gitAddProcess.exited
|
|
445
|
-
|
|
446
|
-
const gitCommitProcess = spawn({
|
|
447
|
-
cmd: ["git", "commit", "-m", "Initial commit - FluxStack project created"],
|
|
448
|
-
cwd: this.targetDir,
|
|
449
|
-
stdout: "pipe",
|
|
450
|
-
stderr: "pipe"
|
|
451
|
-
})
|
|
452
|
-
|
|
453
|
-
await gitCommitProcess.exited
|
|
454
|
-
}
|
|
455
|
-
}
|
package/core/types/api.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API and HTTP-related types
|
|
3
|
-
* Type definitions for API endpoints, requests, responses, and HTTP utilities
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD'
|
|
7
|
-
|
|
8
|
-
export interface ApiEndpoint {
|
|
9
|
-
method: HttpMethod
|
|
10
|
-
path: string
|
|
11
|
-
handler: Function
|
|
12
|
-
schema?: ApiSchema
|
|
13
|
-
middleware?: Function[]
|
|
14
|
-
description?: string
|
|
15
|
-
tags?: string[]
|
|
16
|
-
deprecated?: boolean
|
|
17
|
-
version?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface ApiSchema {
|
|
21
|
-
params?: any
|
|
22
|
-
query?: any
|
|
23
|
-
body?: any
|
|
24
|
-
response?: any
|
|
25
|
-
headers?: any
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ApiResponse<T = any> {
|
|
29
|
-
data?: T
|
|
30
|
-
error?: ApiError
|
|
31
|
-
meta?: ApiMeta
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface ApiError {
|
|
35
|
-
code: string
|
|
36
|
-
message: string
|
|
37
|
-
details?: any
|
|
38
|
-
statusCode: number
|
|
39
|
-
timestamp: string
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface ApiMeta {
|
|
43
|
-
pagination?: PaginationMeta
|
|
44
|
-
timing?: TimingMeta
|
|
45
|
-
version?: string
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface PaginationMeta {
|
|
49
|
-
page: number
|
|
50
|
-
limit: number
|
|
51
|
-
total: number
|
|
52
|
-
totalPages: number
|
|
53
|
-
hasNext: boolean
|
|
54
|
-
hasPrev: boolean
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface TimingMeta {
|
|
58
|
-
requestId: string
|
|
59
|
-
duration: number
|
|
60
|
-
timestamp: string
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface RequestContext {
|
|
64
|
-
id: string
|
|
65
|
-
method: HttpMethod
|
|
66
|
-
path: string
|
|
67
|
-
url: string
|
|
68
|
-
headers: Record<string, string>
|
|
69
|
-
query: Record<string, any>
|
|
70
|
-
params: Record<string, any>
|
|
71
|
-
body?: any
|
|
72
|
-
user?: any
|
|
73
|
-
startTime: number
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface ResponseContext extends RequestContext {
|
|
77
|
-
statusCode: number
|
|
78
|
-
headers: Record<string, string>
|
|
79
|
-
body?: any
|
|
80
|
-
duration: number
|
|
81
|
-
size: number
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface MiddlewareContext {
|
|
85
|
-
request: RequestContext
|
|
86
|
-
response?: ResponseContext
|
|
87
|
-
next: () => Promise<void>
|
|
88
|
-
state: Record<string, any>
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface RouteHandler {
|
|
92
|
-
(context: RequestContext): Promise<any> | any
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface MiddlewareHandler {
|
|
96
|
-
(context: MiddlewareContext): Promise<void> | void
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export interface ApiDocumentation {
|
|
100
|
-
title: string
|
|
101
|
-
version: string
|
|
102
|
-
description?: string
|
|
103
|
-
servers: ApiServer[]
|
|
104
|
-
paths: Record<string, ApiPath>
|
|
105
|
-
components?: ApiComponents
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface ApiServer {
|
|
109
|
-
url: string
|
|
110
|
-
description?: string
|
|
111
|
-
variables?: Record<string, ApiServerVariable>
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface ApiServerVariable {
|
|
115
|
-
default: string
|
|
116
|
-
description?: string
|
|
117
|
-
enum?: string[]
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface ApiPath {
|
|
121
|
-
[method: string]: ApiOperation
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export interface ApiOperation {
|
|
125
|
-
summary?: string
|
|
126
|
-
description?: string
|
|
127
|
-
operationId?: string
|
|
128
|
-
tags?: string[]
|
|
129
|
-
parameters?: ApiParameter[]
|
|
130
|
-
requestBody?: ApiRequestBody
|
|
131
|
-
responses: Record<string, ApiResponse>
|
|
132
|
-
deprecated?: boolean
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface ApiParameter {
|
|
136
|
-
name: string
|
|
137
|
-
in: 'query' | 'header' | 'path' | 'cookie'
|
|
138
|
-
description?: string
|
|
139
|
-
required?: boolean
|
|
140
|
-
schema: any
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface ApiRequestBody {
|
|
144
|
-
description?: string
|
|
145
|
-
content: Record<string, ApiMediaType>
|
|
146
|
-
required?: boolean
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface ApiMediaType {
|
|
150
|
-
schema: any
|
|
151
|
-
example?: any
|
|
152
|
-
examples?: Record<string, ApiExample>
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface ApiExample {
|
|
156
|
-
summary?: string
|
|
157
|
-
description?: string
|
|
158
|
-
value: any
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export interface ApiComponents {
|
|
162
|
-
schemas?: Record<string, any>
|
|
163
|
-
responses?: Record<string, ApiResponse>
|
|
164
|
-
parameters?: Record<string, ApiParameter>
|
|
165
|
-
examples?: Record<string, ApiExample>
|
|
166
|
-
requestBodies?: Record<string, ApiRequestBody>
|
|
167
|
-
headers?: Record<string, any>
|
|
168
|
-
securitySchemes?: Record<string, any>
|
|
169
|
-
}
|