@codeenthusiast09/create-express-app 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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/bin/cli.cjs +12 -0
  4. package/dist/generator.d.ts +59 -0
  5. package/dist/generator.d.ts.map +1 -0
  6. package/dist/generator.js +178 -0
  7. package/dist/generator.js.map +1 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +113 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/installer.d.ts +37 -0
  13. package/dist/installer.d.ts.map +1 -0
  14. package/dist/installer.js +146 -0
  15. package/dist/installer.js.map +1 -0
  16. package/dist/prompts.d.ts +19 -0
  17. package/dist/prompts.d.ts.map +1 -0
  18. package/dist/prompts.js +67 -0
  19. package/dist/prompts.js.map +1 -0
  20. package/package.json +59 -0
  21. package/templates/boilerplate/.env.example +24 -0
  22. package/templates/boilerplate/.eslintrc.cjs +27 -0
  23. package/templates/boilerplate/.prettierrc +9 -0
  24. package/templates/boilerplate/DEPENDENCIES.md +43 -0
  25. package/templates/boilerplate/README.md +282 -0
  26. package/templates/boilerplate/docker/.dockerignore +46 -0
  27. package/templates/boilerplate/docker/Dockerfile +61 -0
  28. package/templates/boilerplate/docker/docker-compose.yml +68 -0
  29. package/templates/boilerplate/drizzle/drizzle.config.ts +13 -0
  30. package/templates/boilerplate/drizzle/schema.ts +22 -0
  31. package/templates/boilerplate/jest.config.cjs +24 -0
  32. package/templates/boilerplate/nodemon.json +11 -0
  33. package/templates/boilerplate/package.json +61 -0
  34. package/templates/boilerplate/prisma/schema.prisma +0 -0
  35. package/templates/boilerplate/scripts/generate-module.cjs +397 -0
  36. package/templates/boilerplate/src/common/middleware/error.middleware.ts +121 -0
  37. package/templates/boilerplate/src/common/middleware/validation.middleware.ts +50 -0
  38. package/templates/boilerplate/src/common/utils/http-logger.ts +24 -0
  39. package/templates/boilerplate/src/common/utils/logger.ts +34 -0
  40. package/templates/boilerplate/src/common/utils/response-helper.ts +140 -0
  41. package/templates/boilerplate/src/config/env.ts +24 -0
  42. package/templates/boilerplate/src/config/index.ts +92 -0
  43. package/templates/boilerplate/src/database/drizzle.connection.ts +50 -0
  44. package/templates/boilerplate/src/database/index.ts +20 -0
  45. package/templates/boilerplate/src/database/mongoose.connection.ts +56 -0
  46. package/templates/boilerplate/src/database/prisma.connection.ts +50 -0
  47. package/templates/boilerplate/src/modules/.gitkeep +0 -0
  48. package/templates/boilerplate/src/server.ts +121 -0
  49. package/templates/boilerplate/src/types/express.types.ts +29 -0
  50. package/templates/boilerplate/src/types/index.ts +5 -0
  51. package/templates/boilerplate/src/types/response.types.ts +54 -0
  52. package/templates/boilerplate/tsconfig.json +72 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 O'Brien Taiwo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # @codeenthusiast09/create-express-app
2
+
3
+ CLI tool to generate production-ready Express TypeScript projects with flexible database options.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ # Using npx (recommended - always uses latest version)
9
+ npx @codeenthusiast09/create-express-app my-project
10
+
11
+ # Or install globally
12
+ npm install -g @codeenthusiast09/create-express-app
13
+ create-express-app my-project
14
+ ```
15
+
16
+ ## What You Get
17
+
18
+ - **Clean Architecture** - NestJS-inspired modular structure
19
+ - **Type Safety** - Strict TypeScript configuration with path aliases
20
+ - **Validation** - Request validation with Zod
21
+ - **Logging** - Structured logging with Pino
22
+ - **Configuration** - Type-safe config with environment validation
23
+ - **Database Flexibility** - Choose MongoDB, PostgreSQL with Prisma, or PostgreSQL with Drizzle
24
+ - **Code Quality** - ESLint + Prettier configured
25
+ - **Docker** - Optional Docker setup with multi-stage builds
26
+ - **Testing** - Jest configured and ready
27
+
28
+ ## Interactive Setup
29
+
30
+ The CLI will ask you:
31
+
32
+ 1. **Project name** - Name of your project
33
+ 2. **Database** - MongoDB or PostgreSQL
34
+ 3. **ORM** (if PostgreSQL) - Prisma or Drizzle
35
+ 4. **Docker** - Include Docker setup? (Yes/No)
36
+
37
+ ## What Happens
38
+
39
+ 1. ✓ Copies template files
40
+ 2. ✓ Configures database based on your choice
41
+ 3. ✓ Installs dependencies
42
+ 4. ✓ Initializes git repository
43
+ 5. ✓ Creates initial commit
44
+ 6. ✓ Shows next steps
45
+
46
+ ## Database Options
47
+
48
+ ### MongoDB with Mongoose
49
+
50
+ - Simple, flexible schema
51
+ - Great for rapid development
52
+ - NoSQL advantages
53
+
54
+ ### PostgreSQL with Prisma
55
+
56
+ - Best-in-class DX
57
+ - Powerful migrations
58
+ - Auto-generated types
59
+ - Recommended for most projects
60
+
61
+ ### PostgreSQL with Drizzle
62
+
63
+ - Maximum type safety
64
+ - Better performance than Prisma
65
+ - SQL-like API
66
+ - For advanced users
67
+
68
+ ## Development
69
+
70
+ ```bash
71
+ # Clone the repository
72
+ git clone <repo-url>
73
+ cd create-express-app
74
+
75
+ # Install dependencies
76
+ npm install
77
+
78
+ # Run in development mode
79
+ npm run dev -- my-test-project
80
+
81
+ # Build for production
82
+ npm run build
83
+
84
+ # Test the built version
85
+ node dist/index.js my-test-project
86
+ ```
87
+
88
+ ## License
89
+
90
+ MIT
package/bin/cli.cjs ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLI Entry Point
5
+ *
6
+ * This file is what gets executed when someone runs:
7
+ * npx create-express-app my-project
8
+ *
9
+ * The shebang (#!/usr/bin/env node) tells the system to run this with Node.js
10
+ */
11
+
12
+ require("../dist/index.js");
@@ -0,0 +1,59 @@
1
+ import { ProjectConfig } from "./prompts";
2
+ /**
3
+ * File Generator
4
+ *
5
+ * This handles copying the template and modifying it based on user's choices.
6
+ */
7
+ export declare class Generator {
8
+ private templatePath;
9
+ private targetPath;
10
+ private config;
11
+ constructor(config: ProjectConfig, targetPath: string);
12
+ /**
13
+ * Generate Project
14
+ *
15
+ * Main function that orchestrates the entire generation process.
16
+ */
17
+ generate(): Promise<void>;
18
+ /**
19
+ * Copy Template Files
20
+ *
21
+ * Copies everything from templates/boilerplate to the target directory.
22
+ */
23
+ private copyTemplate;
24
+ /**
25
+ * Configure Database
26
+ *
27
+ * Modifies database connection files based on user's choice.
28
+ * - MongoDB: Keep mongoose.connection.ts, remove others
29
+ * - PostgreSQL + Prisma: Keep prisma.connection.ts, remove others
30
+ * - PostgreSQL + Drizzle: Keep drizzle.connection.ts, remove others
31
+ */
32
+ /**
33
+ * Configure Database
34
+ */
35
+ private configureDatabase;
36
+ /**
37
+ * Generate Prisma Schema
38
+ */
39
+ private generatePrismaSchema;
40
+ /**
41
+ * Update package.json
42
+ *
43
+ * Updates the project name in package.json
44
+ */
45
+ private updatePackageJson;
46
+ /**
47
+ * Remove Docker Files
48
+ *
49
+ * Removes Docker-related files if user chose not to include Docker.
50
+ */
51
+ private removeDockerFiles;
52
+ /**
53
+ * Clean Git Files
54
+ *
55
+ * Removes .git directory from template so user can init their own.
56
+ */
57
+ private cleanGitFiles;
58
+ }
59
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;GAIG;AAEH,qBAAa,SAAS;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM;IAOrD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB/B;;;;OAIG;YACW,YAAY;IAU1B;;;;;;;OAOG;IACH;;OAEG;YACW,iBAAiB;IAiD/B;;OAEG;YACW,oBAAoB;IAgClC;;;;OAIG;YACW,iBAAiB;IAwB/B;;;;OAIG;YACW,iBAAiB;IAM/B;;;;OAIG;YACW,aAAa;CAG5B"}
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Generator = void 0;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ /**
10
+ * File Generator
11
+ *
12
+ * This handles copying the template and modifying it based on user's choices.
13
+ */
14
+ class Generator {
15
+ constructor(config, targetPath) {
16
+ this.config = config;
17
+ this.targetPath = targetPath;
18
+ // Template is in the templates/boilerplate folder
19
+ this.templatePath = path_1.default.join(__dirname, "..", "templates", "boilerplate");
20
+ }
21
+ /**
22
+ * Generate Project
23
+ *
24
+ * Main function that orchestrates the entire generation process.
25
+ */
26
+ async generate() {
27
+ // 1. Copy all template files to target directory
28
+ await this.copyTemplate();
29
+ // 2. Modify files based on database choice
30
+ await this.configureDatabase();
31
+ // 3. Update package.json with project name
32
+ await this.updatePackageJson();
33
+ // 4. Remove Docker files if not needed
34
+ if (!this.config.includeDocker) {
35
+ await this.removeDockerFiles();
36
+ }
37
+ // 5. Remove .git directory from template (user will init their own)
38
+ await this.cleanGitFiles();
39
+ }
40
+ /**
41
+ * Copy Template Files
42
+ *
43
+ * Copies everything from templates/boilerplate to the target directory.
44
+ */
45
+ async copyTemplate() {
46
+ await fs_extra_1.default.copy(this.templatePath, this.targetPath, {
47
+ filter: (src) => {
48
+ // Don't copy node_modules or dist from template
49
+ const basename = path_1.default.basename(src);
50
+ return basename !== "node_modules" && basename !== "dist";
51
+ },
52
+ });
53
+ }
54
+ /**
55
+ * Configure Database
56
+ *
57
+ * Modifies database connection files based on user's choice.
58
+ * - MongoDB: Keep mongoose.connection.ts, remove others
59
+ * - PostgreSQL + Prisma: Keep prisma.connection.ts, remove others
60
+ * - PostgreSQL + Drizzle: Keep drizzle.connection.ts, remove others
61
+ */
62
+ /**
63
+ * Configure Database
64
+ */
65
+ async configureDatabase() {
66
+ const dbPath = path_1.default.join(this.targetPath, "src", "database");
67
+ const indexPath = path_1.default.join(dbPath, "index.ts");
68
+ if (this.config.database === "mongodb") {
69
+ // Keep Mongoose, remove Prisma and Drizzle
70
+ await fs_extra_1.default.remove(path_1.default.join(dbPath, "prisma.connection.ts"));
71
+ await fs_extra_1.default.remove(path_1.default.join(dbPath, "drizzle.connection.ts"));
72
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "prisma"));
73
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "drizzle"));
74
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "drizzle.config.ts"));
75
+ // Update index.ts to export mongoose
76
+ await fs_extra_1.default.writeFile(indexPath, `/**\n * Database Connection\n * \n * MongoDB with Mongoose\n */\n\nexport * from './mongoose.connection';\n`);
77
+ }
78
+ else if (this.config.database === "postgresql") {
79
+ // Remove Mongoose
80
+ await fs_extra_1.default.remove(path_1.default.join(dbPath, "mongoose.connection.ts"));
81
+ if (this.config.orm === "prisma") {
82
+ // Keep Prisma, remove Drizzle
83
+ await fs_extra_1.default.remove(path_1.default.join(dbPath, "drizzle.connection.ts"));
84
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "drizzle"));
85
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "drizzle.config.ts"));
86
+ // Generate proper Prisma schema
87
+ await this.generatePrismaSchema();
88
+ // Update index.ts to export prisma
89
+ await fs_extra_1.default.writeFile(indexPath, `/**\n * Database Connection\n * \n * PostgreSQL with Prisma\n */\n\nexport * from './prisma.connection';\n`);
90
+ }
91
+ else if (this.config.orm === "drizzle") {
92
+ // Keep Drizzle, remove Prisma
93
+ await fs_extra_1.default.remove(path_1.default.join(dbPath, "prisma.connection.ts"));
94
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "prisma"));
95
+ // Update index.ts to export drizzle
96
+ await fs_extra_1.default.writeFile(indexPath, `/**\n * Database Connection\n * \n * PostgreSQL with Drizzle\n */\n\nexport * from './drizzle.connection';\n`);
97
+ }
98
+ }
99
+ }
100
+ /**
101
+ * Generate Prisma Schema
102
+ */
103
+ async generatePrismaSchema() {
104
+ const prismaDir = path_1.default.join(this.targetPath, "prisma");
105
+ const schemaPath = path_1.default.join(prismaDir, "schema.prisma");
106
+ const schemaContent = `// This is your Prisma schema file
107
+ // Learn more: https://pris.ly/d/prisma-schema
108
+
109
+ generator client {
110
+ provider = "prisma-client-js"
111
+ }
112
+
113
+ datasource db {
114
+ provider = "postgresql"
115
+ url = env("DATABASE_URL")
116
+ }
117
+
118
+ // Example User model
119
+ // Uncomment and modify as needed
120
+ // model User {
121
+ // id String @id @default(uuid())
122
+ // email String @unique
123
+ // name String?
124
+ // password String
125
+ // createdAt DateTime @default(now())
126
+ // updatedAt DateTime @updatedAt
127
+ // }
128
+ `;
129
+ await fs_extra_1.default.ensureDir(prismaDir);
130
+ await fs_extra_1.default.writeFile(schemaPath, schemaContent);
131
+ }
132
+ /**
133
+ * Update package.json
134
+ *
135
+ * Updates the project name in package.json
136
+ */
137
+ async updatePackageJson() {
138
+ const packageJsonPath = path_1.default.join(this.targetPath, "package.json");
139
+ const packageJson = await fs_extra_1.default.readJson(packageJsonPath);
140
+ // Update project metadata
141
+ packageJson.name = this.config.projectName;
142
+ packageJson.version = "0.1.0";
143
+ // Add database-specific scripts
144
+ if (this.config.database === "postgresql") {
145
+ if (this.config.orm === "prisma") {
146
+ packageJson.scripts["db:migrate"] = "prisma migrate dev";
147
+ packageJson.scripts["db:generate"] = "prisma generate";
148
+ packageJson.scripts["db:studio"] = "prisma studio";
149
+ }
150
+ else if (this.config.orm === "drizzle") {
151
+ packageJson.scripts["db:push"] = "drizzle-kit push:pg";
152
+ packageJson.scripts["db:generate"] = "drizzle-kit generate:pg";
153
+ packageJson.scripts["db:studio"] = "drizzle-kit studio";
154
+ }
155
+ }
156
+ await fs_extra_1.default.writeJson(packageJsonPath, packageJson, { spaces: 2 });
157
+ }
158
+ /**
159
+ * Remove Docker Files
160
+ *
161
+ * Removes Docker-related files if user chose not to include Docker.
162
+ */
163
+ async removeDockerFiles() {
164
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "Dockerfile"));
165
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, "docker-compose.yml"));
166
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, ".dockerignore"));
167
+ }
168
+ /**
169
+ * Clean Git Files
170
+ *
171
+ * Removes .git directory from template so user can init their own.
172
+ */
173
+ async cleanGitFiles() {
174
+ await fs_extra_1.default.remove(path_1.default.join(this.targetPath, ".git"));
175
+ }
176
+ }
177
+ exports.Generator = Generator;
178
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../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AC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC;QAClE,MAAM,kBAAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,aAAa;QACzB,MAAM,kBAAE,CAAC,MAAM,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,CAAC;CACF;AAlMD,8BAkMC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const prompts_1 = require("./prompts");
11
+ const generator_1 = require("./generator");
12
+ const installer_1 = require("./installer");
13
+ /**
14
+ * Main CLI Entry Point
15
+ *
16
+ * This orchestrates the entire project generation process:
17
+ * 1. Parse command-line arguments
18
+ * 2. Ask user questions
19
+ * 3. Generate project from template
20
+ * 4. Install dependencies
21
+ * 5. Initialize git
22
+ * 6. Show success message with next steps
23
+ */
24
+ const program = new commander_1.Command();
25
+ program
26
+ .name("create-express-app")
27
+ .description("Generate a production-ready Express TypeScript project")
28
+ .version("1.0.0")
29
+ .argument("[project-name]", "Name of the project")
30
+ .action(async (projectName) => {
31
+ try {
32
+ // Show welcome message
33
+ console.log();
34
+ console.log(chalk_1.default.bold.blue("🚀 Create Express App"));
35
+ console.log();
36
+ // 1. Get user choices
37
+ const config = await (0, prompts_1.promptUser)(projectName);
38
+ // 2. Determine target path
39
+ const targetPath = path_1.default.join(process.cwd(), config.projectName);
40
+ // Check if directory already exists
41
+ if (await fs_extra_1.default.pathExists(targetPath)) {
42
+ console.log();
43
+ console.log(chalk_1.default.red(`❌ Directory "${config.projectName}" already exists!`));
44
+ console.log();
45
+ process.exit(1);
46
+ }
47
+ // 3. Generate project
48
+ console.log();
49
+ console.log(chalk_1.default.cyan("📁 Creating project structure..."));
50
+ const generator = new generator_1.Generator(config, targetPath);
51
+ await generator.generate();
52
+ console.log(chalk_1.default.green("✓ Project structure created"));
53
+ // 4. Install dependencies
54
+ console.log();
55
+ const installer = new installer_1.Installer(config, targetPath);
56
+ await installer.installDependencies();
57
+ // 5. Initialize git
58
+ console.log();
59
+ await installer.initGit();
60
+ // 6. Show success message
61
+ showSuccessMessage(config);
62
+ }
63
+ catch (error) {
64
+ console.log();
65
+ console.log(chalk_1.default.red("❌ Error:"), error);
66
+ console.log();
67
+ process.exit(1);
68
+ }
69
+ });
70
+ /**
71
+ * Show Success Message
72
+ *
73
+ * Displays next steps for the user.
74
+ */
75
+ function showSuccessMessage(config) {
76
+ console.log();
77
+ console.log(chalk_1.default.green.bold("🎉 Success! Your project is ready!"));
78
+ console.log();
79
+ console.log(chalk_1.default.cyan("📋 Next steps:"));
80
+ console.log();
81
+ console.log(chalk_1.default.white(` cd ${config.projectName}`));
82
+ console.log(chalk_1.default.white(" cp .env.example .env"));
83
+ console.log(chalk_1.default.gray(" # Edit .env with your database connection"));
84
+ console.log();
85
+ // Database-specific instructions
86
+ if (config.database === "mongodb") {
87
+ console.log(chalk_1.default.yellow(" # Make sure MongoDB is running"));
88
+ }
89
+ else if (config.database === "postgresql") {
90
+ console.log(chalk_1.default.yellow(" # Make sure PostgreSQL is running"));
91
+ if (config.orm === "prisma") {
92
+ console.log(chalk_1.default.gray(" # Prisma Client already generated ✓"));
93
+ console.log(chalk_1.default.white(" npx prisma migrate dev"));
94
+ console.log(chalk_1.default.gray(" # Run this to create your database tables"));
95
+ }
96
+ else if (config.orm === "drizzle") {
97
+ console.log(chalk_1.default.white(" npx drizzle-kit generate:pg"));
98
+ console.log(chalk_1.default.white(" npx drizzle-kit push:pg"));
99
+ }
100
+ }
101
+ console.log();
102
+ console.log(chalk_1.default.white(" npm run dev"));
103
+ console.log();
104
+ console.log(chalk_1.default.gray(" Server will start at http://localhost:3000"));
105
+ console.log();
106
+ console.log(chalk_1.default.cyan("📚 Documentation: Check README.md"));
107
+ console.log();
108
+ console.log(chalk_1.default.green("Happy coding! 🚀"));
109
+ console.log();
110
+ }
111
+ // Run the program
112
+ program.parse(process.argv);
113
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,yCAAoC;AACpC,kDAA0B;AAC1B,gDAAwB;AACxB,wDAA0B;AAC1B,uCAAuC;AACvC,2CAAwC;AACxC,2CAAwC;AAExC;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,oBAAoB,CAAC;KAC1B,WAAW,CAAC,wDAAwD,CAAC;KACrE,OAAO,CAAC,OAAO,CAAC;KAChB,QAAQ,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;KACjD,MAAM,CAAC,KAAK,EAAE,WAAoB,EAAE,EAAE;IACrC,IAAI,CAAC;QACH,uBAAuB;QACvB,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,sBAAsB;QACtB,MAAM,MAAM,GAAG,MAAM,IAAA,oBAAU,EAAC,WAAW,CAAC,CAAC;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AC,eAAK,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC,CAAC;QACzE,CAAC;aAAM,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC;AAED,kBAAkB;AAClB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { ProjectConfig } from "./prompts";
2
+ /**
3
+ * Installer
4
+ *
5
+ * Handles post-generation tasks:
6
+ * - Installing dependencies
7
+ * - Initializing git repository
8
+ */
9
+ export declare class Installer {
10
+ private projectPath;
11
+ private config;
12
+ constructor(config: ProjectConfig, projectPath: string);
13
+ /**
14
+ * Install Dependencies
15
+ *
16
+ * Runs npm install in the project directory.
17
+ * Also installs database-specific dependencies.
18
+ */
19
+ installDependencies(): Promise<void>;
20
+ /**
21
+ * Install Database-Specific Dependencies
22
+ */
23
+ private installDatabaseDependencies;
24
+ /**
25
+ * Run Post-Install Tasks
26
+ *
27
+ * Runs necessary setup commands after dependencies are installed
28
+ */
29
+ private runPostInstallTasks;
30
+ /**
31
+ * Initialize Git Repository
32
+ *
33
+ * Runs git init and makes an initial commit.
34
+ */
35
+ initGit(): Promise<void>;
36
+ }
37
+ //# sourceMappingURL=installer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../src/installer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;GAMG;AAEH,qBAAa,SAAS;IACpB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM;IAKtD;;;;;OAKG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB1C;;OAEG;YACW,2BAA2B;IAqCzC;;;;OAIG;YACW,mBAAmB;IAkBjC;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CA2C/B"}