@mostajs/setup 2.1.18 → 2.1.20

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
  }
@@ -58,12 +60,16 @@ export async function runInstall(installConfig, setupConfig) {
58
60
  port: setupConfig.defaultPort,
59
61
  });
60
62
  }
61
- // 3. Set process.env in-memory
63
+ // 3. Set process.env in-memory (force ORM mode even if app started as NET)
64
+ process.env.MOSTA_DATA = 'orm';
62
65
  process.env.DB_DIALECT = installConfig.dialect;
63
66
  process.env.SGBD_URI = uri;
64
67
  if (installConfig.dialect !== 'mongodb') {
65
68
  process.env.DB_SCHEMA_STRATEGY = 'update';
66
69
  }
70
+ // Clear NET vars to avoid confusion
71
+ delete process.env.MOSTA_NET_URL;
72
+ delete process.env.MOSTA_NET_TRANSPORT;
67
73
  // 4. Disconnect existing dialect singleton
68
74
  const { disconnectDialect } = await import('@mostajs/orm');
69
75
  await disconnectDialect();
@@ -116,6 +122,9 @@ export async function runInstall(installConfig, setupConfig) {
116
122
  */
117
123
  async function runNetInstall(installConfig, setupConfig) {
118
124
  try {
125
+ // Force NET mode in-memory (even if app started as ORM)
126
+ process.env.MOSTA_DATA = 'net';
127
+ process.env.MOSTA_NET_URL = installConfig.net.url;
119
128
  const net = new NetClient({
120
129
  url: installConfig.net.url,
121
130
  apiKey: installConfig.net.apiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostajs/setup",
3
- "version": "2.1.18",
3
+ "version": "2.1.20",
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",