@ahmadubaidillah/core 1.1.7 → 1.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.
- package/dist/index.js +25 -1
- package/dist/plugins/admin-panel/files/src/modules/admin/routes/admin.routes.tsx +26 -0
- package/dist/plugins/admin-panel/plugin.config.json +6 -1
- package/dist/plugins/auth/plugin.config.json +5 -0
- package/dist/plugins/payments/plugin.config.json +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8977,7 +8977,12 @@ var init_plugin_loader = __esm(() => {
|
|
|
8977
8977
|
compatibleTemplates: z.array(z.string()),
|
|
8978
8978
|
dependencies: z.array(z.string()).default([]),
|
|
8979
8979
|
packageDependencies: z.record(z.string()).default({}),
|
|
8980
|
-
packageDevDependencies: z.record(z.string()).default({})
|
|
8980
|
+
packageDevDependencies: z.record(z.string()).default({}),
|
|
8981
|
+
routeInfo: z.object({
|
|
8982
|
+
path: z.string(),
|
|
8983
|
+
importFile: z.string(),
|
|
8984
|
+
exportName: z.string()
|
|
8985
|
+
}).optional()
|
|
8981
8986
|
});
|
|
8982
8987
|
});
|
|
8983
8988
|
|
|
@@ -26442,6 +26447,25 @@ async function installPlugin(pluginName, projectDir, options) {
|
|
|
26442
26447
|
throw new Error(`Failed to parse target package.json during plugin installation: ${e.message}`);
|
|
26443
26448
|
}
|
|
26444
26449
|
}
|
|
26450
|
+
if (config.routeInfo) {
|
|
26451
|
+
const appPath = join5(projectDir, "src", "app.tsx");
|
|
26452
|
+
if (existsSync4(appPath)) {
|
|
26453
|
+
let appContent = readFileSync4(appPath, "utf8");
|
|
26454
|
+
const importStmt = `import { ${config.routeInfo.exportName} } from '${config.routeInfo.importFile}';
|
|
26455
|
+
`;
|
|
26456
|
+
if (!appContent.includes(config.routeInfo.importFile)) {
|
|
26457
|
+
appContent = importStmt + appContent;
|
|
26458
|
+
}
|
|
26459
|
+
const routeStmt = `api.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
|
|
26460
|
+
`;
|
|
26461
|
+
if (!appContent.includes(routeStmt)) {
|
|
26462
|
+
const injectionPoint = "// [PLUGIN_ROUTES_INJECTION_POINT]";
|
|
26463
|
+
appContent = appContent.replace(injectionPoint, `${injectionPoint}
|
|
26464
|
+
${routeStmt}`);
|
|
26465
|
+
}
|
|
26466
|
+
writeFileSync2(appPath, appContent);
|
|
26467
|
+
}
|
|
26468
|
+
}
|
|
26445
26469
|
return {
|
|
26446
26470
|
success: true,
|
|
26447
26471
|
pluginName
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
import { jsx } from 'hono/jsx';
|
|
4
|
+
import { AdminDashboard } from '../views/AdminDashboard';
|
|
5
|
+
|
|
6
|
+
export const adminRoutes = new Hono();
|
|
7
|
+
|
|
8
|
+
adminRoutes.get('/', (c) => {
|
|
9
|
+
return c.html(
|
|
10
|
+
<html lang="en">
|
|
11
|
+
<head>
|
|
12
|
+
<meta charset="UTF-8" />
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
14
|
+
<title>Admin Dashboard | DevForge</title>
|
|
15
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
|
16
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet" />
|
|
17
|
+
<style>{`
|
|
18
|
+
body { font-family: 'Inter', sans-serif; }
|
|
19
|
+
`}</style>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
<AdminDashboard />
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
25
|
+
);
|
|
26
|
+
});
|