@mostajs/setup 2.1.24 → 2.1.25

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.
@@ -8,10 +8,11 @@ import { runInstall } from '../lib/setup.js';
8
8
  */
9
9
  export function createInstallHandler(needsSetup, setupConfig) {
10
10
  async function POST(req) {
11
- if (!(await needsSetup())) {
12
- return Response.json({ error: 'Already installed' }, { status: 400 });
13
- }
14
11
  const body = await req.json();
12
+ // Skip needsSetup check if admin was already created (wizard creates admin before seed)
13
+ if (!body.skipCheck && !(await needsSetup())) {
14
+ return Response.json({ ok: false, error: 'Installation deja effectuee' }, { status: 400 });
15
+ }
15
16
  const result = await runInstall(body, setupConfig);
16
17
  return Response.json(result);
17
18
  }
@@ -749,6 +749,7 @@ export default function SetupWizard({ t: tProp, onComplete, endpoints = {}, dbNa
749
749
  admin: { email: adminConfig.email, password: adminConfig.password, firstName: adminConfig.firstName, lastName: adminConfig.lastName },
750
750
  seed: seedOptions,
751
751
  modules: selectedModules,
752
+ skipCheck: adminSaveResult?.ok || false, // Skip needsSetup check if admin was created via wizard
752
753
  }),
753
754
  });
754
755
  const data = await safeJson(res);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostajs/setup",
3
- "version": "2.1.24",
3
+ "version": "2.1.25",
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",