@morojs/cli 1.0.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 (47) hide show
  1. package/README.md +300 -0
  2. package/bin/cli.js +4 -0
  3. package/dist/cli.d.ts +4 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +426 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/config.d.ts +17 -0
  8. package/dist/commands/config.d.ts.map +1 -0
  9. package/dist/commands/config.js +334 -0
  10. package/dist/commands/config.js.map +1 -0
  11. package/dist/commands/database.d.ts +38 -0
  12. package/dist/commands/database.d.ts.map +1 -0
  13. package/dist/commands/database.js +523 -0
  14. package/dist/commands/database.js.map +1 -0
  15. package/dist/commands/deploy.d.ts +18 -0
  16. package/dist/commands/deploy.d.ts.map +1 -0
  17. package/dist/commands/deploy.js +166 -0
  18. package/dist/commands/deploy.js.map +1 -0
  19. package/dist/commands/dev.d.ts +27 -0
  20. package/dist/commands/dev.d.ts.map +1 -0
  21. package/dist/commands/dev.js +216 -0
  22. package/dist/commands/dev.js.map +1 -0
  23. package/dist/commands/init.d.ts +27 -0
  24. package/dist/commands/init.d.ts.map +1 -0
  25. package/dist/commands/init.js +1061 -0
  26. package/dist/commands/init.js.map +1 -0
  27. package/dist/commands/middleware.d.ts +11 -0
  28. package/dist/commands/middleware.d.ts.map +1 -0
  29. package/dist/commands/middleware.js +229 -0
  30. package/dist/commands/middleware.js.map +1 -0
  31. package/dist/index.d.ts +4 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +11 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/logger.d.ts +7 -0
  36. package/dist/logger.d.ts.map +1 -0
  37. package/dist/logger.js +23 -0
  38. package/dist/logger.js.map +1 -0
  39. package/dist/module-stub-generator.d.ts +16 -0
  40. package/dist/module-stub-generator.d.ts.map +1 -0
  41. package/dist/module-stub-generator.js +505 -0
  42. package/dist/module-stub-generator.js.map +1 -0
  43. package/dist/utils/terminal.d.ts +11 -0
  44. package/dist/utils/terminal.d.ts.map +1 -0
  45. package/dist/utils/terminal.js +43 -0
  46. package/dist/utils/terminal.js.map +1 -0
  47. package/package.json +97 -0
@@ -0,0 +1,523 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DatabaseManager = void 0;
4
+ // Database Management - Setup adapters, run migrations and seeds
5
+ const promises_1 = require("fs/promises");
6
+ const path_1 = require("path");
7
+ const fs_1 = require("fs");
8
+ const logger_1 = require("../logger");
9
+ class DatabaseManager {
10
+ constructor() {
11
+ this.logger = (0, logger_1.createFrameworkLogger)('DatabaseManager');
12
+ }
13
+ async setupAdapter(type, options) {
14
+ this.logger.info(`Setting up ${type} database adapter...`, 'Database');
15
+ try {
16
+ // Create database directory structure
17
+ await this.createDatabaseStructure();
18
+ // Generate adapter configuration
19
+ await this.generateAdapterConfig(type, options);
20
+ // Generate migration system if requested
21
+ if (options.withMigrations) {
22
+ await this.generateMigrationSystem(type);
23
+ }
24
+ // Generate seed system if requested
25
+ if (options.withSeeds) {
26
+ await this.generateSeedSystem(type);
27
+ }
28
+ this.logger.info('✅ Database adapter setup complete!', 'Database');
29
+ this.logger.info('Next steps:', 'Database');
30
+ this.logger.info(' 1. Update your .env file with database credentials', 'Database');
31
+ this.logger.info(' 2. Run migrations: morojs-cli db migrate --up', 'Database');
32
+ this.logger.info(' 3. Seed data: morojs-cli db seed', 'Database');
33
+ }
34
+ catch (error) {
35
+ this.logger.error(`Failed to setup database adapter: ${error instanceof Error ? error.message : 'Unknown error'}`, 'Database');
36
+ throw error;
37
+ }
38
+ }
39
+ async runMigrations(options) {
40
+ const migrationsDir = (0, path_1.join)(process.cwd(), 'src', 'database', 'migrations');
41
+ if (!(0, fs_1.existsSync)(migrationsDir)) {
42
+ this.logger.error('❌ No migrations directory found. Run "morojs-cli db setup <type> --with-migrations" first.', 'Database');
43
+ return;
44
+ }
45
+ try {
46
+ if (options.reset) {
47
+ this.logger.info('Resetting all migrations...', 'Database');
48
+ await this.resetMigrations();
49
+ }
50
+ else if (options.down) {
51
+ this.logger.info(' Running migrations down...', 'Database');
52
+ await this.runMigrationsDown();
53
+ }
54
+ else {
55
+ this.logger.info(' Running migrations up...', 'Database');
56
+ await this.runMigrationsUp();
57
+ }
58
+ this.logger.info('✅ Migrations completed successfully!', 'Database');
59
+ }
60
+ catch (error) {
61
+ this.logger.error(`Migration failed: ${error instanceof Error ? error.message : 'Unknown error'}`, 'Database');
62
+ throw error;
63
+ }
64
+ }
65
+ async runSeeds(options) {
66
+ const seedsDir = (0, path_1.join)(process.cwd(), 'src', 'database', 'seeds');
67
+ if (!(0, fs_1.existsSync)(seedsDir)) {
68
+ this.logger.error('❌ No seeds directory found. Run "morojs-cli db setup <type> --with-seeds" first.', 'Database');
69
+ return;
70
+ }
71
+ try {
72
+ this.logger.info(`Running seeds for ${options.environment || 'development'} environment...`, 'Database');
73
+ await this.executeSeedFiles(options.environment || 'development');
74
+ this.logger.info('✅ Database seeded successfully!', 'Database');
75
+ }
76
+ catch (error) {
77
+ this.logger.error(`Seeding failed: ${error instanceof Error ? error.message : 'Unknown error'}`, 'Database');
78
+ throw error;
79
+ }
80
+ }
81
+ async createDatabaseStructure() {
82
+ const directories = [
83
+ 'src/database',
84
+ 'src/database/adapters',
85
+ 'src/database/migrations',
86
+ 'src/database/seeds',
87
+ ];
88
+ for (const dir of directories) {
89
+ await (0, promises_1.mkdir)((0, path_1.join)(process.cwd(), dir), { recursive: true });
90
+ }
91
+ }
92
+ async generateAdapterConfig(type, options) {
93
+ const adapterConfigs = {
94
+ postgresql: this.generatePostgreSQLConfig(options),
95
+ mysql: this.generateMySQLConfig(options),
96
+ sqlite: this.generateSQLiteConfig(options),
97
+ mongodb: this.generateMongoDBConfig(options),
98
+ redis: this.generateRedisConfig(options),
99
+ drizzle: this.generateDrizzleConfig(options),
100
+ };
101
+ const config = adapterConfigs[type];
102
+ if (!config) {
103
+ throw new Error(`Unsupported database type: ${type}`);
104
+ }
105
+ await (0, promises_1.writeFile)((0, path_1.join)(process.cwd(), 'src', 'database', 'index.ts'), config.setup);
106
+ // Generate adapter-specific files
107
+ if ('adapter' in config && config.adapter) {
108
+ await (0, promises_1.writeFile)((0, path_1.join)(process.cwd(), 'src', 'database', 'adapters', `${type}.ts`), config.adapter);
109
+ }
110
+ // Update .env template
111
+ if ('env' in config && config.env) {
112
+ await this.updateEnvTemplate(config.env);
113
+ }
114
+ }
115
+ generatePostgreSQLConfig(options) {
116
+ return {
117
+ setup: `// PostgreSQL Database Setup
118
+ import { PostgreSQLAdapter } from '@morojs/moro';
119
+ import { createFrameworkLogger } from '@morojs/moro';
120
+
121
+ const logger = createFrameworkLogger('PostgreSQL');
122
+
123
+ export async function setupDatabase(app: any): Promise<PostgreSQLAdapter> {
124
+ const adapter = new PostgreSQLAdapter({
125
+ host: process.env.POSTGRES_HOST || '${options.host || 'localhost'}',
126
+ port: parseInt(process.env.POSTGRES_PORT || '5432'),
127
+ username: process.env.POSTGRES_USER || '${options.username || 'postgres'}',
128
+ password: process.env.POSTGRES_PASSWORD || '',
129
+ database: process.env.POSTGRES_DB || '${options.database || 'myapp'}',
130
+ ssl: process.env.NODE_ENV === 'production' ? { rejectUnauthorized: false } : false,
131
+ connectionLimit: 10,
132
+ acquireTimeout: 60000,
133
+ timeout: 60000
134
+ });
135
+
136
+ try {
137
+ await adapter.connect();
138
+ app.database(adapter);
139
+ logger.info('✅ PostgreSQL connected successfully', 'Database');
140
+ return adapter;
141
+ } catch (error) {
142
+ logger.error('❌ PostgreSQL connection failed:', error, 'Database');
143
+ throw error;
144
+ }
145
+ }`,
146
+ env: `
147
+ # PostgreSQL Configuration
148
+ POSTGRES_HOST=${options.host || 'localhost'}
149
+ POSTGRES_PORT=5432
150
+ POSTGRES_USER=${options.username || 'postgres'}
151
+ POSTGRES_PASSWORD=
152
+ POSTGRES_DB=${options.database || 'myapp'}
153
+ DATABASE_URL=postgresql://\${POSTGRES_USER}:\${POSTGRES_PASSWORD}@\${POSTGRES_HOST}:\${POSTGRES_PORT}/\${POSTGRES_DB}`,
154
+ };
155
+ }
156
+ generateMySQLConfig(options) {
157
+ return {
158
+ setup: `// MySQL Database Setup
159
+ import { MySQLAdapter } from '@morojs/moro';
160
+ import { createFrameworkLogger } from '@morojs/moro';
161
+
162
+ const logger = createFrameworkLogger('MySQL');
163
+
164
+ export async function setupDatabase(app: any): Promise<MySQLAdapter> {
165
+ const adapter = new MySQLAdapter({
166
+ host: process.env.MYSQL_HOST || '${options.host || 'localhost'}',
167
+ port: parseInt(process.env.MYSQL_PORT || '3306'),
168
+ user: process.env.MYSQL_USER || '${options.username || 'root'}',
169
+ password: process.env.MYSQL_PASSWORD || '',
170
+ database: process.env.MYSQL_DATABASE || '${options.database || 'myapp'}',
171
+ connectionLimit: 10,
172
+ acquireTimeout: 60000,
173
+ timeout: 60000,
174
+ reconnect: true
175
+ });
176
+
177
+ try {
178
+ await adapter.connect();
179
+ app.database(adapter);
180
+ logger.info('✅ MySQL connected successfully', 'Database');
181
+ return adapter;
182
+ } catch (error) {
183
+ logger.error('❌ MySQL connection failed:', error, 'Database');
184
+ throw error;
185
+ }
186
+ }`,
187
+ env: `
188
+ # MySQL Configuration
189
+ MYSQL_HOST=${options.host || 'localhost'}
190
+ MYSQL_PORT=3306
191
+ MYSQL_USER=${options.username || 'root'}
192
+ MYSQL_PASSWORD=
193
+ MYSQL_DATABASE=${options.database || 'myapp'}
194
+ DATABASE_URL=mysql://\${MYSQL_USER}:\${MYSQL_PASSWORD}@\${MYSQL_HOST}:\${MYSQL_PORT}/\${MYSQL_DATABASE}`,
195
+ };
196
+ }
197
+ generateSQLiteConfig(options) {
198
+ return {
199
+ setup: `// SQLite Database Setup
200
+ import { SQLiteAdapter } from '@morojs/moro';
201
+ import { createFrameworkLogger } from '@morojs/moro';
202
+
203
+ const logger = createFrameworkLogger('SQLite');
204
+
205
+ export async function setupDatabase(app: any): Promise<SQLiteAdapter> {
206
+ const adapter = new SQLiteAdapter({
207
+ filename: process.env.SQLITE_DATABASE || '${options.database || './data/app.db'}',
208
+ verbose: process.env.NODE_ENV === 'development'
209
+ });
210
+
211
+ try {
212
+ await adapter.connect();
213
+ app.database(adapter);
214
+ logger.info('✅ SQLite connected successfully', 'Database');
215
+ return adapter;
216
+ } catch (error) {
217
+ logger.error('❌ SQLite connection failed:', error, 'Database');
218
+ throw error;
219
+ }
220
+ }`,
221
+ env: `
222
+ # SQLite Configuration
223
+ SQLITE_DATABASE=./data/app.db
224
+ DATABASE_URL=sqlite://\${SQLITE_DATABASE}`,
225
+ };
226
+ }
227
+ generateMongoDBConfig(options) {
228
+ return {
229
+ setup: `// MongoDB Database Setup
230
+ import { MongoDBAdapter } from '@morojs/moro';
231
+ import { createFrameworkLogger } from '@morojs/moro';
232
+
233
+ const logger = createFrameworkLogger('MongoDB');
234
+
235
+ export async function setupDatabase(app: any): Promise<MongoDBAdapter> {
236
+ const adapter = new MongoDBAdapter({
237
+ url: process.env.MONGODB_URI || 'mongodb://${options.host || 'localhost'}:27017/${options.database || 'myapp'}',
238
+ options: {
239
+ maxPoolSize: 10,
240
+ serverSelectionTimeoutMS: 5000,
241
+ socketTimeoutMS: 45000
242
+ }
243
+ });
244
+
245
+ try {
246
+ await adapter.connect();
247
+ app.database(adapter);
248
+ logger.info('✅ MongoDB connected successfully', 'Database');
249
+ return adapter;
250
+ } catch (error) {
251
+ logger.error('❌ MongoDB connection failed:', error, 'Database');
252
+ throw error;
253
+ }
254
+ }`,
255
+ env: `
256
+ # MongoDB Configuration
257
+ MONGODB_URI=mongodb://${options.host || 'localhost'}:27017/${options.database || 'myapp'}
258
+ DATABASE_URL=\${MONGODB_URI}`,
259
+ };
260
+ }
261
+ generateRedisConfig(options) {
262
+ return {
263
+ setup: `// Redis Database Setup
264
+ import { RedisAdapter } from '@morojs/moro';
265
+ import { createFrameworkLogger } from '@morojs/moro';
266
+
267
+ const logger = createFrameworkLogger('Redis');
268
+
269
+ export async function setupDatabase(app: any): Promise<RedisAdapter> {
270
+ const adapter = new RedisAdapter({
271
+ host: process.env.REDIS_HOST || '${options.host || 'localhost'}',
272
+ port: parseInt(process.env.REDIS_PORT || '6379'),
273
+ password: process.env.REDIS_PASSWORD,
274
+ db: parseInt(process.env.REDIS_DB || '0'),
275
+ keyPrefix: process.env.REDIS_KEY_PREFIX || 'moro:',
276
+ retryDelayOnFailover: 100,
277
+ maxRetriesPerRequest: 3
278
+ });
279
+
280
+ try {
281
+ await adapter.connect();
282
+ app.database(adapter);
283
+ logger.info('✅ Redis connected successfully', 'Database');
284
+ return adapter;
285
+ } catch (error) {
286
+ logger.error('❌ Redis connection failed:', error, 'Database');
287
+ throw error;
288
+ }
289
+ }`,
290
+ env: `
291
+ # Redis Configuration
292
+ REDIS_HOST=${options.host || 'localhost'}
293
+ REDIS_PORT=6379
294
+ REDIS_PASSWORD=
295
+ REDIS_DB=0
296
+ REDIS_KEY_PREFIX=moro:
297
+ REDIS_URL=redis://\${REDIS_HOST}:\${REDIS_PORT}/\${REDIS_DB}
298
+ DATABASE_URL=\${REDIS_URL}`,
299
+ };
300
+ }
301
+ generateDrizzleConfig(_options) {
302
+ return {
303
+ setup: `// Drizzle ORM Setup
304
+ import { DrizzleAdapter } from '@morojs/moro';
305
+ import { createFrameworkLogger } from '@morojs/moro';
306
+ import { drizzle } from 'drizzle-orm/node-postgres';
307
+ import { Client } from 'pg';
308
+
309
+ const logger = createFrameworkLogger('Drizzle');
310
+
311
+ export async function setupDatabase(app: any): Promise<DrizzleAdapter> {
312
+ const client = new Client({
313
+ connectionString: process.env.DATABASE_URL,
314
+ ssl: process.env.NODE_ENV === 'production' ? { rejectUnauthorized: false } : false
315
+ });
316
+
317
+ await client.connect();
318
+ const db = drizzle(client);
319
+
320
+ const adapter = new DrizzleAdapter({
321
+ db,
322
+ client
323
+ });
324
+
325
+ try {
326
+ app.database(adapter);
327
+ logger.info('✅ Drizzle ORM connected successfully', 'Database');
328
+ return adapter;
329
+ } catch (error) {
330
+ logger.error('❌ Drizzle ORM connection failed:', error, 'Database');
331
+ throw error;
332
+ }
333
+ }`,
334
+ adapter: `// Drizzle Schema Example
335
+ import { pgTable, serial, varchar, timestamp, boolean } from 'drizzle-orm/pg-core';
336
+
337
+ export const users = pgTable('users', {
338
+ id: serial('id').primaryKey(),
339
+ name: varchar('name', { length: 255 }).notNull(),
340
+ email: varchar('email', { length: 255 }).notNull().unique(),
341
+ active: boolean('active').default(true),
342
+ createdAt: timestamp('created_at').defaultNow(),
343
+ updatedAt: timestamp('updated_at').defaultNow()
344
+ });
345
+
346
+ export type User = typeof users.$inferSelect;
347
+ export type NewUser = typeof users.$inferInsert;`,
348
+ env: `
349
+ # Drizzle ORM Configuration (PostgreSQL)
350
+ DATABASE_URL=postgresql://username:password@localhost:5432/database_name`,
351
+ };
352
+ }
353
+ async generateMigrationSystem(_type) {
354
+ // Generate migration runner
355
+ const migrationRunner = `// Database Migration Runner
356
+ import { readdir, readFile } from 'fs/promises';
357
+ import { join } from 'path';
358
+ import { createFrameworkLogger } from '@morojs/moro';
359
+
360
+ const logger = createFrameworkLogger('Migrations');
361
+
362
+ export class MigrationRunner {
363
+ constructor(private adapter: any) {}
364
+
365
+ async runUp(): Promise<void> {
366
+ const migrations = await this.getMigrations();
367
+
368
+ for (const migration of migrations) {
369
+ logger.info(\`Running migration: \${migration.name}\`, 'Migration');
370
+ await this.executeMigration(migration.up);
371
+ logger.info(\`✅ Migration completed: \${migration.name}\`, 'Migration');
372
+ }
373
+ }
374
+
375
+ async runDown(): Promise<void> {
376
+ const migrations = await this.getMigrations();
377
+
378
+ for (const migration of migrations.reverse()) {
379
+ logger.info(\`Reversing migration: \${migration.name}\`, 'Migration');
380
+ await this.executeMigration(migration.down);
381
+ logger.info(\`✅ Migration reversed: \${migration.name}\`, 'Migration');
382
+ }
383
+ }
384
+
385
+ private async getMigrations() {
386
+ const migrationsDir = join(process.cwd(), 'src', 'database', 'migrations');
387
+ const files = await readdir(migrationsDir);
388
+
389
+ return files
390
+ .filter(file => file.endsWith('.sql'))
391
+ .sort()
392
+ .map(async file => {
393
+ const content = await readFile(join(migrationsDir, file), 'utf-8');
394
+ const [up, down] = content.split('-- DOWN');
395
+
396
+ return {
397
+ name: file,
398
+ up: up.replace('-- UP', '').trim(),
399
+ down: down ? down.trim() : ''
400
+ };
401
+ });
402
+ }
403
+
404
+ private async executeMigration(sql: string): Promise<void> {
405
+ if (!sql) return;
406
+ await this.adapter.query(sql);
407
+ }
408
+ }`;
409
+ await (0, promises_1.writeFile)((0, path_1.join)(process.cwd(), 'src', 'database', 'migration-runner.ts'), migrationRunner);
410
+ // Generate sample migration
411
+ const sampleMigration = `-- UP
412
+ CREATE TABLE IF NOT EXISTS users (
413
+ id SERIAL PRIMARY KEY,
414
+ name VARCHAR(255) NOT NULL,
415
+ email VARCHAR(255) NOT NULL UNIQUE,
416
+ password_hash VARCHAR(255) NOT NULL,
417
+ active BOOLEAN DEFAULT TRUE,
418
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
419
+ updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
420
+ );
421
+
422
+ CREATE INDEX idx_users_email ON users(email);
423
+ CREATE INDEX idx_users_created_at ON users(created_at);
424
+
425
+ -- DOWN
426
+ DROP TABLE IF EXISTS users;`;
427
+ await (0, promises_1.writeFile)((0, path_1.join)(process.cwd(), 'src', 'database', 'migrations', '001_create_users_table.sql'), sampleMigration);
428
+ }
429
+ async generateSeedSystem(_type) {
430
+ // Generate seed runner
431
+ const seedRunner = `// Database Seed Runner
432
+ import { readdir, readFile } from 'fs/promises';
433
+ import { join } from 'path';
434
+ import { createFrameworkLogger } from '@morojs/moro';
435
+
436
+ const logger = createFrameworkLogger('Seeds');
437
+
438
+ export class SeedRunner {
439
+ constructor(private adapter: any) {}
440
+
441
+ async run(environment: string = 'development'): Promise<void> {
442
+ const seeds = await this.getSeeds(environment);
443
+
444
+ for (const seed of seeds) {
445
+ logger.info(\`Running seed: \${seed.name}\`, 'Seed');
446
+ await this.executeSeed(seed.sql);
447
+ logger.info(\`✅ Seed completed: \${seed.name}\`, 'Seed');
448
+ }
449
+ }
450
+
451
+ private async getSeeds(environment: string) {
452
+ const seedsDir = join(process.cwd(), 'src', 'database', 'seeds');
453
+ const files = await readdir(seedsDir);
454
+
455
+ return files
456
+ .filter(file => file.endsWith('.sql') && file.includes(environment))
457
+ .sort()
458
+ .map(async file => {
459
+ const content = await readFile(join(seedsDir, file), 'utf-8');
460
+ return {
461
+ name: file,
462
+ sql: content
463
+ };
464
+ });
465
+ }
466
+
467
+ private async executeSeed(sql: string): Promise<void> {
468
+ if (!sql) return;
469
+ await this.adapter.query(sql);
470
+ }
471
+ }`;
472
+ await (0, promises_1.writeFile)((0, path_1.join)(process.cwd(), 'src', 'database', 'seed-runner.ts'), seedRunner);
473
+ // Generate sample seeds
474
+ const developmentSeed = `-- Development Seed Data
475
+ INSERT INTO users (name, email, password_hash) VALUES
476
+ ('Admin User', 'admin@example.com', '$2b$12$example_hash_here'),
477
+ ('John Doe', 'john@example.com', '$2b$12$example_hash_here'),
478
+ ('Jane Smith', 'jane@example.com', '$2b$12$example_hash_here');`;
479
+ const productionSeed = `-- Production Seed Data
480
+ INSERT INTO users (name, email, password_hash) VALUES
481
+ ('System Admin', 'admin@yourdomain.com', '$2b$12$your_actual_hash_here');`;
482
+ await (0, promises_1.writeFile)((0, path_1.join)(process.cwd(), 'src', 'database', 'seeds', 'development.sql'), developmentSeed);
483
+ await (0, promises_1.writeFile)((0, path_1.join)(process.cwd(), 'src', 'database', 'seeds', 'production.sql'), productionSeed);
484
+ }
485
+ async updateEnvTemplate(envContent) {
486
+ const envPath = (0, path_1.join)(process.cwd(), '.env.example');
487
+ try {
488
+ let existingContent = '';
489
+ if ((0, fs_1.existsSync)(envPath)) {
490
+ existingContent = await (0, promises_1.readFile)(envPath, 'utf-8');
491
+ }
492
+ const updatedContent = existingContent + '\n' + envContent;
493
+ await (0, promises_1.writeFile)(envPath, updatedContent);
494
+ }
495
+ catch (error) {
496
+ // If we can't update, just log a warning
497
+ this.logger.warn('Could not update .env.example file', 'Database');
498
+ }
499
+ }
500
+ async runMigrationsUp() {
501
+ // Implementation would depend on the database type
502
+ // For now, just log the action
503
+ this.logger.info('Migration system would run here', 'Database');
504
+ this.logger.info('Implement actual migration logic based on your database adapter', 'Database');
505
+ }
506
+ async runMigrationsDown() {
507
+ // Implementation would depend on the database type
508
+ this.logger.info('Migration rollback system would run here', 'Database');
509
+ this.logger.info('Implement actual migration rollback logic based on your database adapter', 'Database');
510
+ }
511
+ async resetMigrations() {
512
+ // Implementation would depend on the database type
513
+ this.logger.info('Migration reset system would run here', 'Database');
514
+ this.logger.info('Implement actual migration reset logic based on your database adapter', 'Database');
515
+ }
516
+ async executeSeedFiles(environment) {
517
+ // Implementation would depend on the database type
518
+ this.logger.info(`Seed execution system would run here for ${environment}`, 'Database');
519
+ this.logger.info('Implement actual seed execution logic based on your database adapter', 'Database');
520
+ }
521
+ }
522
+ exports.DatabaseManager = DatabaseManager;
523
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/commands/database.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,0CAAyD;AACzD,+BAA4B;AAC5B,2BAAgC;AAChC,sCAAkD;AAqBlD,MAAa,eAAe;IAA5B;QACU,WAAM,GAAG,IAAA,8BAAqB,EAAC,iBAAiB,CAAC,CAAC;IAykB5D,CAAC;IAvkBC,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,OAA6B;QAC5D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,sBAAsB,EAAE,UAAU,CAAC,CAAC;QAEvE,IAAI,CAAC;YACH,sCAAsC;YACtC,MAAM,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAErC,iCAAiC;YACjC,MAAM,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CA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AAC,MAAM,CAAC,IAAI,CACd,sEAAsE,EACtE,UAAU,CACX,CAAC;IACJ,CAAC;CACF;AA1kBD,0CA0kBC"}
@@ -0,0 +1,18 @@
1
+ export interface VercelOptions {
2
+ domain?: string;
3
+ }
4
+ export interface LambdaOptions {
5
+ region?: string;
6
+ memory?: string;
7
+ timeout?: string;
8
+ }
9
+ export interface WorkersOptions {
10
+ name?: string;
11
+ }
12
+ export declare class DeploymentManager {
13
+ private logger;
14
+ setupVercel(options: VercelOptions): Promise<void>;
15
+ setupLambda(options: LambdaOptions): Promise<void>;
16
+ setupCloudflareWorkers(options: WorkersOptions): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=deploy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAA8C;IAEtD,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDlD,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAwElD,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CA8CrE"}