@jhits/dashboard 0.0.4 → 0.0.6
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.
- package/package.json +4 -2
- package/src/config.ts +56 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jhits/dashboard",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A comprehensive dashboard system built to manage custom built websites - plugin based SaaS system.",
|
|
5
5
|
"main": "./src/index.tsx",
|
|
6
6
|
"types": "./src/index.tsx",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"lint": "eslint"
|
|
33
|
+
"lint": "eslint",
|
|
34
|
+
"type-check": "tsc --noEmit",
|
|
35
|
+
"type-check:all": "bash ../check-types.sh"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@jhits/plugin-blog": "^0.0.1",
|
package/src/config.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import 'server-only';
|
|
2
|
-
|
|
3
1
|
// packages/jhits-dashboard/src/config.ts
|
|
4
2
|
import type { NextConfig } from "next";
|
|
5
3
|
import { writeFileSync, mkdirSync, existsSync, readFileSync } from "fs";
|
|
@@ -81,7 +79,7 @@ async function ensureDashboardRoutes() {
|
|
|
81
79
|
writeFileSync(catchAllPath, `// Auto-generated by @jhits/dashboard - do not edit manually
|
|
82
80
|
export { default } from '@jhits/dashboard/catch-all';
|
|
83
81
|
`);
|
|
84
|
-
} catch
|
|
82
|
+
} catch {
|
|
85
83
|
// Silently fail - routes might already exist or be manually created
|
|
86
84
|
}
|
|
87
85
|
}
|
|
@@ -140,7 +138,7 @@ function findJhitsPackages(): string[] {
|
|
|
140
138
|
|
|
141
139
|
// Always include the base @jhits pattern for any other packages
|
|
142
140
|
return jhitsPackages.length > 0 ? jhitsPackages : ['@jhits'];
|
|
143
|
-
} catch
|
|
141
|
+
} catch {
|
|
144
142
|
// Fallback to wildcard on any error
|
|
145
143
|
console.warn('[withJhitsDashboard] Could not read package.json, using @jhits wildcard');
|
|
146
144
|
return ['@jhits'];
|
|
@@ -164,7 +162,7 @@ export function withJhitsDashboard(nextConfig: NextConfig = {}): NextConfig {
|
|
|
164
162
|
try {
|
|
165
163
|
ensureDashboardRoutes();
|
|
166
164
|
// ensureUserManagementRoutes(); // Disabled - routes are handled by plugin-users via plugin router
|
|
167
|
-
} catch
|
|
165
|
+
} catch {
|
|
168
166
|
// Ignore errors - routes might already exist
|
|
169
167
|
}
|
|
170
168
|
}
|
|
@@ -211,15 +209,64 @@ export function withJhitsDashboard(nextConfig: NextConfig = {}): NextConfig {
|
|
|
211
209
|
net: false,
|
|
212
210
|
tls: false,
|
|
213
211
|
crypto: false,
|
|
212
|
+
stream: false,
|
|
213
|
+
util: false,
|
|
214
|
+
url: false,
|
|
215
|
+
http: false,
|
|
216
|
+
https: false,
|
|
217
|
+
zlib: false,
|
|
218
|
+
os: false,
|
|
219
|
+
buffer: false,
|
|
220
|
+
process: false,
|
|
221
|
+
// WASI modules
|
|
222
|
+
wasi_snapshot_preview1: false,
|
|
214
223
|
};
|
|
215
224
|
|
|
216
|
-
// Prevent server-only
|
|
217
|
-
|
|
225
|
+
// Prevent server-only packages from being bundled into client
|
|
226
|
+
const serverOnlyPackages = [
|
|
227
|
+
'@jhits/plugin-dep',
|
|
228
|
+
'nodemailer',
|
|
229
|
+
'mongodb',
|
|
230
|
+
'bcrypt',
|
|
231
|
+
'bcryptjs',
|
|
232
|
+
'jsonwebtoken',
|
|
233
|
+
];
|
|
234
|
+
|
|
218
235
|
config.externals = config.externals || [];
|
|
219
236
|
if (Array.isArray(config.externals)) {
|
|
220
|
-
config.externals.push(
|
|
237
|
+
config.externals.push(...serverOnlyPackages);
|
|
221
238
|
} else if (typeof config.externals === 'object') {
|
|
222
|
-
|
|
239
|
+
serverOnlyPackages.forEach((pkg) => {
|
|
240
|
+
config.externals[pkg] = pkg;
|
|
241
|
+
});
|
|
242
|
+
} else if (typeof config.externals === 'function') {
|
|
243
|
+
const originalExternals = config.externals;
|
|
244
|
+
config.externals = (
|
|
245
|
+
context: string,
|
|
246
|
+
request: string,
|
|
247
|
+
callback: (err?: Error | null, result?: string) => void
|
|
248
|
+
) => {
|
|
249
|
+
if (serverOnlyPackages.includes(request)) {
|
|
250
|
+
return callback(null, `commonjs ${request}`);
|
|
251
|
+
}
|
|
252
|
+
return originalExternals(context, request, callback);
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Ignore server-only plugin files using IgnorePlugin
|
|
257
|
+
// This prevents webpack from trying to bundle server-only files
|
|
258
|
+
try {
|
|
259
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
260
|
+
const webpack = require('webpack');
|
|
261
|
+
config.plugins = config.plugins || [];
|
|
262
|
+
config.plugins.push(
|
|
263
|
+
new webpack.IgnorePlugin({
|
|
264
|
+
resourceRegExp: /^@jhits\/plugin-dep\/src\/(actions|router|index\.server)$/,
|
|
265
|
+
})
|
|
266
|
+
);
|
|
267
|
+
} catch {
|
|
268
|
+
// webpack might not be available in all contexts (e.g., Turbopack)
|
|
269
|
+
// This is fine - the externals and browser field should handle it
|
|
223
270
|
}
|
|
224
271
|
}
|
|
225
272
|
return config;
|