@stardust-bytes/agent-hub 0.2.0 → 0.3.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.
- package/bin/workspace-cli.js +18 -5
- package/package.json +1 -1
package/bin/workspace-cli.js
CHANGED
|
@@ -68,10 +68,7 @@ function runMigrations() {
|
|
|
68
68
|
cwd: backendDir, stdio: 'inherit', env,
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
execSync(`npx prisma generate --schema="${schemaPath}"`, {
|
|
73
|
-
cwd: backendDir, stdio: 'inherit', env,
|
|
74
|
-
});
|
|
71
|
+
generatePrismaClient();
|
|
75
72
|
|
|
76
73
|
log('init', 'Seeding database...');
|
|
77
74
|
execSync('npx prisma db seed', {
|
|
@@ -79,6 +76,21 @@ function runMigrations() {
|
|
|
79
76
|
});
|
|
80
77
|
}
|
|
81
78
|
|
|
79
|
+
function generatePrismaClient() {
|
|
80
|
+
const schemaPath = path.join(ROOT, 'backend', 'prisma', 'schema.prisma');
|
|
81
|
+
const backendDir = path.join(ROOT, 'backend');
|
|
82
|
+
const env = { ...process.env, DATABASE_URL: `file:${DB_PATH}` };
|
|
83
|
+
|
|
84
|
+
log('init', 'Generating Prisma client...');
|
|
85
|
+
try {
|
|
86
|
+
execSync(`npx prisma generate --schema="${schemaPath}"`, {
|
|
87
|
+
cwd: backendDir, stdio: 'pipe', env,
|
|
88
|
+
});
|
|
89
|
+
} catch (e) {
|
|
90
|
+
log('init', 'Warning: prisma generate failed:', e.message);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
function getPort() {
|
|
83
95
|
return process.env.PORT ?? '17135';
|
|
84
96
|
}
|
|
@@ -101,7 +113,7 @@ function resolveEnv() {
|
|
|
101
113
|
}
|
|
102
114
|
}
|
|
103
115
|
|
|
104
|
-
function waitForServer(port, maxRetries =
|
|
116
|
+
function waitForServer(port, maxRetries = 120) {
|
|
105
117
|
return new Promise((resolve, reject) => {
|
|
106
118
|
let retries = 0;
|
|
107
119
|
const check = () => {
|
|
@@ -161,6 +173,7 @@ async function cmdStudio() {
|
|
|
161
173
|
if (needsMigration()) {
|
|
162
174
|
runMigrations();
|
|
163
175
|
}
|
|
176
|
+
generatePrismaClient();
|
|
164
177
|
resolveEnv();
|
|
165
178
|
|
|
166
179
|
const server = spawn('node', [BACKEND_ENTRY], {
|