@mostajs/setup 2.1.7 → 2.1.8
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.
|
@@ -443,15 +443,29 @@ export default function SetupWizard({ t: tProp, onComplete, endpoints = {}, dbNa
|
|
|
443
443
|
.then((data) => {
|
|
444
444
|
const seeds = data.config?.seeds ?? [];
|
|
445
445
|
setAvailableSeeds(seeds);
|
|
446
|
-
// Initialize seedOptions from defaults
|
|
446
|
+
// Initialize seedOptions from defaults
|
|
447
447
|
setSeedOptions(prev => {
|
|
448
|
-
if (Object.keys(prev).length > 0)
|
|
449
|
-
return prev;
|
|
450
448
|
const defaults = {};
|
|
451
449
|
for (const s of seeds)
|
|
452
|
-
defaults[s.key] = s.default;
|
|
450
|
+
defaults[s.key] = prev[s.key] ?? s.default;
|
|
453
451
|
return defaults;
|
|
454
452
|
});
|
|
453
|
+
// Load modules from setup.json if not provided via props
|
|
454
|
+
const mods = data.config?.modules ?? [];
|
|
455
|
+
if (mods.length > 0 && availableModules.length === 0) {
|
|
456
|
+
setAvailableModules(mods.map((m) => ({
|
|
457
|
+
key: m.key, packageName: m.packageName || m.key,
|
|
458
|
+
label: m.label || m.key, description: m.description || '',
|
|
459
|
+
icon: m.icon || '', required: m.required || false,
|
|
460
|
+
dependsOn: m.dependsOn || [], installed: false,
|
|
461
|
+
})));
|
|
462
|
+
// Pre-select required modules
|
|
463
|
+
setSelectedModules(prev => {
|
|
464
|
+
if (prev.length > 0)
|
|
465
|
+
return prev;
|
|
466
|
+
return mods.filter((m) => m.required || m.default).map((m) => m.key);
|
|
467
|
+
});
|
|
468
|
+
}
|
|
455
469
|
})
|
|
456
470
|
.catch(() => { });
|
|
457
471
|
}, [hydrated]);
|
|
@@ -750,7 +764,7 @@ export default function SetupWizard({ t: tProp, onComplete, endpoints = {}, dbNa
|
|
|
750
764
|
function canGoNext() {
|
|
751
765
|
switch (step) {
|
|
752
766
|
case 'welcome': return true;
|
|
753
|
-
case 'modules': return selectedModules.length > 0;
|
|
767
|
+
case 'modules': return availableModules.length === 0 || selectedModules.length > 0;
|
|
754
768
|
case 'dialect': return true;
|
|
755
769
|
case 'database':
|
|
756
770
|
if (dialect === 'sqlite' || dialect === 'spanner')
|
package/package.json
CHANGED