@mostajs/setup 1.4.14 → 1.4.15

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.
@@ -91,22 +91,26 @@ export function createWireModuleHandler() {
91
91
  const wireFile = path.join(mostaDir, dir, `${dir}.wire.json`);
92
92
  if (fs.existsSync(wireFile)) {
93
93
  const manifest = JSON.parse(fs.readFileSync(wireFile, 'utf8'));
94
- // Check if already wired by looking at schemas or permissions in host files
95
- const permFile = path.join(root, 'src/lib/permissions.ts');
96
- let installed = false;
97
- if (manifest.permissions?.permissionsConst && fs.existsSync(permFile)) {
98
- installed = fs.readFileSync(permFile, 'utf8').includes(manifest.permissions.permissionsConst);
99
- }
100
- else if (manifest.schemas?.exports?.[0]) {
101
- const regFile = path.join(root, 'src/dal/registry.ts');
102
- if (fs.existsSync(regFile)) {
103
- installed = fs.readFileSync(regFile, 'utf8').includes(manifest.schemas.exports[0]);
94
+ // Check if already wired primary: package in dependencies
95
+ const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
96
+ let installed = !!pkg.dependencies?.[manifest.package];
97
+ // Fallback: check host source files for legacy codegen markers
98
+ if (!installed) {
99
+ const permFile = path.join(root, 'src/lib/permissions.ts');
100
+ if (manifest.permissions?.permissionsConst && fs.existsSync(permFile)) {
101
+ installed = fs.readFileSync(permFile, 'utf8').includes(manifest.permissions.permissionsConst);
104
102
  }
105
- }
106
- else if (manifest.menu?.name) {
107
- const sidebarFile = path.join(root, 'src/components/layout/Sidebar.tsx');
108
- if (fs.existsSync(sidebarFile)) {
109
- installed = fs.readFileSync(sidebarFile, 'utf8').includes(manifest.menu.name);
103
+ else if (manifest.schemas?.exports?.[0]) {
104
+ const regFile = path.join(root, 'src/dal/registry.ts');
105
+ if (fs.existsSync(regFile)) {
106
+ installed = fs.readFileSync(regFile, 'utf8').includes(manifest.schemas.exports[0]);
107
+ }
108
+ }
109
+ else if (manifest.menu?.name) {
110
+ const sidebarFile = path.join(root, 'src/components/layout/Sidebar.tsx');
111
+ if (fs.existsSync(sidebarFile)) {
112
+ installed = fs.readFileSync(sidebarFile, 'utf8').includes(manifest.menu.name);
113
+ }
110
114
  }
111
115
  }
112
116
  found.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostajs/setup",
3
- "version": "1.4.14",
3
+ "version": "1.4.15",
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",