lapeh 2.4.1 → 2.4.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.
- package/bin/index.js +45 -2
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -34,6 +34,23 @@ switch (command) {
|
|
|
34
34
|
function runDev() {
|
|
35
35
|
console.log('🚀 Starting Lapeh in development mode...');
|
|
36
36
|
try {
|
|
37
|
+
// Generate Prisma Client before starting
|
|
38
|
+
console.log('🔄 Generating Prisma Client...');
|
|
39
|
+
const compileSchemaPath = path.join(process.cwd(), 'scripts/compile-schema.js');
|
|
40
|
+
if (fs.existsSync(compileSchemaPath)) {
|
|
41
|
+
try {
|
|
42
|
+
execSync('node scripts/compile-schema.js', { stdio: 'inherit' });
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.warn('⚠️ Failed to run compile-schema.js', e.message);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
execSync('npx prisma generate', { stdio: 'inherit' });
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.warn('⚠️ Failed to run prisma generate. Continuing...', e.message);
|
|
52
|
+
}
|
|
53
|
+
|
|
37
54
|
const tsNodePath = require.resolve('ts-node/register');
|
|
38
55
|
const tsConfigPathsPath = require.resolve('tsconfig-paths/register');
|
|
39
56
|
|
|
@@ -192,8 +209,34 @@ function runStart() {
|
|
|
192
209
|
|
|
193
210
|
function runBuild() {
|
|
194
211
|
console.log('🛠️ Building Lapeh project...');
|
|
195
|
-
|
|
196
|
-
|
|
212
|
+
|
|
213
|
+
// Compile schema if script exists
|
|
214
|
+
const compileSchemaPath = path.join(process.cwd(), 'scripts/compile-schema.js');
|
|
215
|
+
if (fs.existsSync(compileSchemaPath)) {
|
|
216
|
+
try {
|
|
217
|
+
execSync('node scripts/compile-schema.js', { stdio: 'inherit' });
|
|
218
|
+
} catch (e) {
|
|
219
|
+
console.error('❌ Failed to compile schema.');
|
|
220
|
+
process.exit(1);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Generate prisma client
|
|
225
|
+
try {
|
|
226
|
+
execSync('npx prisma generate', { stdio: 'inherit' });
|
|
227
|
+
} catch (e) {
|
|
228
|
+
console.error('❌ Failed to generate prisma client.');
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Compile TS
|
|
233
|
+
try {
|
|
234
|
+
execSync('npx tsc && npx tsc-alias', { stdio: 'inherit' });
|
|
235
|
+
} catch (e) {
|
|
236
|
+
console.error('❌ Build failed.');
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
239
|
+
|
|
197
240
|
console.log('✅ Build complete.');
|
|
198
241
|
}
|
|
199
242
|
|