@mostajs/setup 2.1.17 → 2.1.19

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.
@@ -38,6 +38,10 @@ export async function writeEnvLocal(options) {
38
38
  else if (/^DB_SCHEMA_STRATEGY=/m.test(content)) {
39
39
  content = content.replace(/^DB_SCHEMA_STRATEGY=.*$/m, '#DB_SCHEMA_STRATEGY=update');
40
40
  }
41
+ // Mode ORM : commenter les lignes NET résiduelles
42
+ content = content.replace(/^MOSTA_NET_URL=(.+)$/m, '#MOSTA_NET_URL=$1');
43
+ content = content.replace(/^MOSTA_NET_TRANSPORT=(.+)$/m, '#MOSTA_NET_TRANSPORT=$1');
44
+ content = content.replace(/^MOSTA_NET_API_KEY=(.+)$/m, '#MOSTA_NET_API_KEY=$1');
41
45
  }
42
46
  // Write extra vars
43
47
  if (extraVars) {
package/dist/lib/setup.js CHANGED
@@ -35,6 +35,8 @@ export async function runInstall(installConfig, setupConfig) {
35
35
  // 1. Compose URI and write .env.local
36
36
  const uri = composeDbUri(installConfig.dialect, installConfig.db);
37
37
  const extraVars = { ...setupConfig.extraEnvVars };
38
+ // Mode ORM : forcer MOSTA_DATA=orm (écrase un éventuel =net résiduel)
39
+ extraVars['MOSTA_DATA'] = 'orm';
38
40
  if (installConfig.modules?.length) {
39
41
  extraVars['MOSTAJS_MODULES'] = installConfig.modules.join(',');
40
42
  }
@@ -302,6 +304,20 @@ async function runNetInstall(installConfig, setupConfig) {
302
304
  seeded.push(seedDef.key);
303
305
  }
304
306
  }
307
+ // 6. Run code-based optionalSeeds (e.g. demoAccess: resolve slugs, create accesses)
308
+ if (setupConfig.optionalSeeds && installConfig.seed) {
309
+ for (const seedDef of setupConfig.optionalSeeds) {
310
+ if (installConfig.seed[seedDef.key]) {
311
+ try {
312
+ await seedDef.run({});
313
+ seeded.push(seedDef.key);
314
+ }
315
+ catch (e) {
316
+ console.error(`[Setup NET] optionalSeed "${seedDef.key}" failed:`, e);
317
+ }
318
+ }
319
+ }
320
+ }
305
321
  // Écrire .env.local en DERNIER (après tout le seed)
306
322
  // pour éviter le hot-reload Next.js pendant le seed
307
323
  await writeEnvLocal({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostajs/setup",
3
- "version": "2.1.17",
3
+ "version": "2.1.19",
4
4
  "description": "Reusable setup wizard module — multi-dialect DB configuration, .env.local writer, seed runner",
5
5
  "author": "Dr Hamid MADANI <drmdh@msn.com>",
6
6
  "license": "MIT",