@rws-framework/db 2.4.2 → 2.4.3

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.
@@ -49,24 +49,7 @@ class DbHelper {
49
49
  }
50
50
  fs_1.default.writeFileSync(schemaPath, template);
51
51
  process.env = { ...process.env, [this.dbUrlVarName]: dbUrl };
52
- // Use npx directly with the full path to prisma
53
- const npxPath = path_1.default.join(workspaceRoot, 'node_modules', '.bin', 'npx');
54
- const prismaPath = path_1.default.join(workspaceRoot, 'node_modules', '.bin', 'prisma');
55
- try {
56
- // Try using npx with the full path
57
- await console_1.rwsShell.runCommand(`"${npxPath}" prisma generate --schema="${schemaPath}"`, process.cwd());
58
- }
59
- catch (error) {
60
- // If that fails, try using the prisma binary directly
61
- try {
62
- await console_1.rwsShell.runCommand(`"${prismaPath}" generate --schema="${schemaPath}"`, process.cwd());
63
- }
64
- catch (innerError) {
65
- // If both fail, try using node to run prisma
66
- const nodePrismaPath = path_1.default.join(workspaceRoot, 'node_modules', 'prisma', 'build', 'index.js');
67
- await console_1.rwsShell.runCommand(`node "${nodePrismaPath}" generate --schema="${schemaPath}"`, process.cwd());
68
- }
69
- }
52
+ await console_1.rwsShell.runCommand(`${this.detectInstaller()} prisma generate --schema="${schemaPath}"`, process.cwd());
70
53
  leaveFile = false;
71
54
  log(chalk_1.default.green('[RWS Init]') + ' prisma schema generated from ', schemaPath);
72
55
  if (!leaveFile) {
@@ -102,9 +85,6 @@ class DbHelper {
102
85
  process.env = { ...process.env, [this.dbUrlVarName]: configService.get('db_url') };
103
86
  const schemaDir = path_1.default.join(moduleDir, 'prisma');
104
87
  const schemaPath = path_1.default.join(schemaDir, 'schema.prisma');
105
- // Use npx directly with the full path to prisma
106
- const execCmdPath = path_1.default.join(workspaceRoot, 'node_modules', '.bin', 'yarn.cmd');
107
- const execPrismaPath = path_1.default.join(workspaceRoot, 'node_modules', '.bin', 'yarn.cmd');
108
88
  await console_1.rwsShell.runCommand(`${this.detectInstaller()} prisma db push --schema="${schemaPath}"`, process.cwd());
109
89
  }
110
90
  static async generateModelSections(model, configService) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/db",
3
3
  "private": false,
4
- "version": "2.4.2",
4
+ "version": "2.4.3",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -67,25 +67,9 @@ export class DbHelper {
67
67
  }
68
68
 
69
69
  fs.writeFileSync(schemaPath, template);
70
- process.env = { ...process.env, [this.dbUrlVarName]: dbUrl }
70
+ process.env = { ...process.env, [this.dbUrlVarName]: dbUrl }
71
71
 
72
- // Use npx directly with the full path to prisma
73
- const npxPath = path.join(workspaceRoot, 'node_modules', '.bin', 'npx');
74
- const prismaPath = path.join(workspaceRoot, 'node_modules', '.bin', 'prisma');
75
-
76
- try {
77
- // Try using npx with the full path
78
- await rwsShell.runCommand(`"${npxPath}" prisma generate --schema="${schemaPath}"`, process.cwd());
79
- } catch (error) {
80
- // If that fails, try using the prisma binary directly
81
- try {
82
- await rwsShell.runCommand(`"${prismaPath}" generate --schema="${schemaPath}"`, process.cwd());
83
- } catch (innerError) {
84
- // If both fail, try using node to run prisma
85
- const nodePrismaPath = path.join(workspaceRoot, 'node_modules', 'prisma', 'build', 'index.js');
86
- await rwsShell.runCommand(`node "${nodePrismaPath}" generate --schema="${schemaPath}"`, process.cwd());
87
- }
88
- }
72
+ await rwsShell.runCommand(`${this.detectInstaller()} prisma generate --schema="${schemaPath}"`, process.cwd());
89
73
 
90
74
  leaveFile = false;
91
75
  log(chalk.green('[RWS Init]') + ' prisma schema generated from ', schemaPath);
@@ -137,11 +121,7 @@ export class DbHelper {
137
121
  process.env = { ...process.env, [this.dbUrlVarName]: configService.get('db_url') }
138
122
  const schemaDir = path.join(moduleDir, 'prisma');
139
123
  const schemaPath = path.join(schemaDir, 'schema.prisma');
140
-
141
- // Use npx directly with the full path to prisma
142
- const execCmdPath = path.join(workspaceRoot, 'node_modules', '.bin', 'yarn.cmd');
143
- const execPrismaPath = path.join(workspaceRoot, 'node_modules', '.bin', 'yarn.cmd');
144
-
124
+
145
125
  await rwsShell.runCommand(`${this.detectInstaller()} prisma db push --schema="${schemaPath}"`, process.cwd());
146
126
 
147
127
  }