@shakil-dev/shakil-stack 2.0.3 → 2.1.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.
Files changed (2) hide show
  1. package/bin/index.js +17 -5
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -343,16 +343,17 @@ export const sanitizeRequest = (req: Request, res: Response, next: NextFunction)
343
343
  };
344
344
  `;
345
345
 
346
- const schemaPrisma = `generator client {
346
+ const basePrisma = `generator client {
347
347
  provider = "prisma-client-js"
348
+ previewFeatures = ["prismaSchemaFolder"]
348
349
  }
349
350
 
350
351
  datasource db {
351
352
  provider = "postgresql"
352
- url = env("DATABASE_URL")
353
353
  }
354
+ `;
354
355
 
355
- model User {
356
+ const userPrisma = `model User {
356
357
  id String @id @default(uuid())
357
358
  email String @unique
358
359
  name String
@@ -395,7 +396,7 @@ import { defineConfig } from "prisma/config";
395
396
  import process from "process";
396
397
 
397
398
  export default defineConfig({
398
- schema: "prisma/schema.prisma",
399
+ schema: "prisma/schema",
399
400
  datasource: {
400
401
  url: process.env.DATABASE_URL,
401
402
  },
@@ -463,7 +464,8 @@ export default sendResponse;
463
464
  await fs.outputFile(path.join(projectPath, 'backend', 'src', 'app', 'utils', 'sendResponse.ts'), sendResponseTs);
464
465
  await fs.outputFile(path.join(projectPath, 'backend', 'src', 'app', 'utils', 'sanitizer.ts'), sanitizerTs);
465
466
  await fs.outputFile(path.join(projectPath, 'backend', 'src', 'app', 'errorHelpers', 'ApiError.ts'), apiErrorTs);
466
- await fs.outputFile(path.join(projectPath, 'backend', 'prisma', 'schema.prisma'), schemaPrisma);
467
+ await fs.outputFile(path.join(projectPath, 'backend', 'prisma', 'schema', 'base.prisma'), basePrisma);
468
+ await fs.outputFile(path.join(projectPath, 'backend', 'prisma', 'schema', 'user.prisma'), userPrisma);
467
469
  await fs.outputFile(path.join(projectPath, 'backend', 'prisma.config.ts'), prismaConfigTs);
468
470
  await fs.outputFile(path.join(projectPath, 'backend', 'tsconfig.json'), tsconfigTs);
469
471
  await fs.outputFile(path.join(projectPath, 'backend', '.gitignore'), 'node_modules\ndist\n.env');
@@ -639,6 +641,16 @@ export const ${moduleName}Validations = {
639
641
  `,
640
642
  };
641
643
 
644
+ // Add Prisma schema for the module
645
+ const modulePrisma = `model ${moduleName} {
646
+ id String @id @default(uuid())
647
+ name String
648
+ createdAt DateTime @default(now())
649
+ updatedAt DateTime @updatedAt
650
+ }
651
+ `;
652
+ await fs.outputFile(path.join(backendRoot, 'prisma', 'schema', `${lowercaseName}.prisma`), modulePrisma);
653
+
642
654
  for (const [ext, content] of Object.entries(files)) {
643
655
  await fs.outputFile(path.join(moduleDir, `${lowercaseName}.${ext}`), content);
644
656
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shakil-dev/shakil-stack",
3
- "version": "2.0.3",
3
+ "version": "2.1.2",
4
4
  "description": "Full-stack EchoNet-style project generator CLI",
5
5
  "keywords": [
6
6
  "shakil-stack",