@mostajs/setup 2.1.16 → 2.1.18
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/dist/lib/setup.js +24 -8
- package/package.json +1 -1
package/dist/lib/setup.js
CHANGED
|
@@ -120,8 +120,8 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
120
120
|
url: installConfig.net.url,
|
|
121
121
|
apiKey: installConfig.net.apiKey,
|
|
122
122
|
});
|
|
123
|
-
// 1.
|
|
124
|
-
//
|
|
123
|
+
// 1. Préparer les vars .env.local (écriture REPORTÉE à la fin pour éviter
|
|
124
|
+
// le hot-reload de Next.js qui interrompt le seed en cours)
|
|
125
125
|
const extraVars = {
|
|
126
126
|
MOSTA_DATA: 'net',
|
|
127
127
|
MOSTA_NET_URL: installConfig.net.url,
|
|
@@ -132,11 +132,6 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
132
132
|
if (installConfig.modules?.length) {
|
|
133
133
|
extraVars['MOSTAJS_MODULES'] = installConfig.modules.join(',');
|
|
134
134
|
}
|
|
135
|
-
await writeEnvLocal({
|
|
136
|
-
skipDb: true, // Ne pas écrire DB_DIALECT/SGBD_URI
|
|
137
|
-
extraVars,
|
|
138
|
-
port: setupConfig.defaultPort,
|
|
139
|
-
});
|
|
140
135
|
const seeded = [];
|
|
141
136
|
// 2. Verify NET server is reachable
|
|
142
137
|
const health = await net.health();
|
|
@@ -307,7 +302,28 @@ async function runNetInstall(installConfig, setupConfig) {
|
|
|
307
302
|
seeded.push(seedDef.key);
|
|
308
303
|
}
|
|
309
304
|
}
|
|
310
|
-
|
|
305
|
+
// 6. Run code-based optionalSeeds (e.g. demoAccess: resolve slugs, create accesses)
|
|
306
|
+
if (setupConfig.optionalSeeds && installConfig.seed) {
|
|
307
|
+
for (const seedDef of setupConfig.optionalSeeds) {
|
|
308
|
+
if (installConfig.seed[seedDef.key]) {
|
|
309
|
+
try {
|
|
310
|
+
await seedDef.run({});
|
|
311
|
+
seeded.push(seedDef.key);
|
|
312
|
+
}
|
|
313
|
+
catch (e) {
|
|
314
|
+
console.error(`[Setup NET] optionalSeed "${seedDef.key}" failed:`, e);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// Écrire .env.local en DERNIER (après tout le seed)
|
|
320
|
+
// pour éviter le hot-reload Next.js pendant le seed
|
|
321
|
+
await writeEnvLocal({
|
|
322
|
+
skipDb: true,
|
|
323
|
+
extraVars,
|
|
324
|
+
port: setupConfig.defaultPort,
|
|
325
|
+
});
|
|
326
|
+
return { ok: true, needsRestart: true, seeded };
|
|
311
327
|
}
|
|
312
328
|
catch (err) {
|
|
313
329
|
const message = err instanceof Error ? err.message : 'Erreur installation NET';
|
package/package.json
CHANGED