@shakil-dev/shakil-stack 1.1.0 → 1.2.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 (2) hide show
  1. package/bin/index.js +40 -2
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -69,6 +69,7 @@ async function main() {
69
69
  spinner.text = `📦 Running create-next-app for frontend...`;
70
70
  spinner.stop();
71
71
 
72
+ // We run create-next-app in the project root to create the 'frontend' folder
72
73
  const nextAppCmd = `npx create-next-app@latest frontend --typescript --tailwind --eslint --app --src-dir --import-alias "@/*" --use-${packageManager} --no-git`;
73
74
  try {
74
75
  execSync(nextAppCmd, { cwd: projectPath, stdio: 'inherit' });
@@ -88,9 +89,9 @@ async function main() {
88
89
  // 5. Root Files
89
90
  await fs.outputFile(path.join(projectPath, '.env'), 'DATABASE_URL="postgresql://user:password@localhost:5432/mydb"\nPORT=8000\nNODE_ENV=development\nJWT_SECRET="your-secret-key"');
90
91
  await fs.outputFile(path.join(projectPath, '.gitignore'), 'node_modules\n.env\ndist\n*.db\n.next\n.DS_Store');
91
- await fs.outputFile(path.join(projectPath, 'README.md'), `# ${projectName}\n\nGenerated with Full EchoNet-style CLI.`);
92
+ await fs.outputFile(path.join(projectPath, 'README.md'), `# ${projectName}\n\nGenerated with Full Shakil-Stack CLI.`);
92
93
 
93
- // 6. Backend Files (Refined)
94
+ // 6. Backend Files (Complete EchoNet Clone)
94
95
 
95
96
  const serverTs = `import { Server } from 'http';
96
97
  import app from './app.js';
@@ -304,6 +305,7 @@ export const sanitizeRequest = (req: Request, res: Response, next: NextFunction)
304
305
 
305
306
  datasource db {
306
307
  provider = "postgresql"
308
+ url = env("DATABASE_URL")
307
309
  }
308
310
 
309
311
  model User {
@@ -342,6 +344,39 @@ model Account {
342
344
  updatedAt DateTime @updatedAt
343
345
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
344
346
  }
347
+ `;
348
+
349
+ const prismaConfigTs = `import "dotenv/config";
350
+ import { defineConfig } from "prisma/config";
351
+ import process from "process";
352
+
353
+ export default defineConfig({
354
+ schema: "prisma/schema.prisma",
355
+ datasource: {
356
+ url: process.env.DATABASE_URL,
357
+ },
358
+ });
359
+ `;
360
+
361
+ const tsconfigTs = `{
362
+ "compilerOptions": {
363
+ "target": "ES2022",
364
+ "module": "NodeNext",
365
+ "moduleResolution": "NodeNext",
366
+ "outDir": "./dist",
367
+ "rootDir": "./src",
368
+ "strict": true,
369
+ "esModuleInterop": true,
370
+ "skipLibCheck": true,
371
+ "forceConsistentCasingInFileNames": true,
372
+ "baseUrl": ".",
373
+ "paths": {
374
+ "@/*": ["src/*"]
375
+ }
376
+ },
377
+ "include": ["src/**/*"],
378
+ "exclude": ["node_modules", "dist"]
379
+ }
345
380
  `;
346
381
 
347
382
  // Write backend files
@@ -358,6 +393,9 @@ model Account {
358
393
  await fs.outputFile(path.join(projectPath, 'backend', 'src', 'app', 'utils', 'sanitizer.ts'), sanitizerTs);
359
394
  await fs.outputFile(path.join(projectPath, 'backend', 'src', 'app', 'errorHelpers', 'ApiError.ts'), apiErrorTs);
360
395
  await fs.outputFile(path.join(projectPath, 'backend', 'prisma', 'schema.prisma'), schemaPrisma);
396
+ await fs.outputFile(path.join(projectPath, 'backend', 'prisma.config.ts'), prismaConfigTs);
397
+ await fs.outputFile(path.join(projectPath, 'backend', 'tsconfig.json'), tsconfigTs);
398
+ await fs.outputFile(path.join(projectPath, 'backend', '.gitignore'), 'node_modules\ndist\n.env');
361
399
  await fs.outputFile(path.join(projectPath, 'backend', '.env'), 'DATABASE_URL="postgresql://user:password@localhost:5432/mydb"\nJWT_SECRET="your-secret-key"');
362
400
 
363
401
  // Backend package.json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shakil-dev/shakil-stack",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Full-stack EchoNet-style project generator CLI",
5
5
  "main": "./bin/index.js",
6
6
  "bin": {