@ahmadubaidillah/core 1.1.6 → 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 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
@@ -26498,7 +26522,12 @@ var { copySync, readFileSync: readFileSync2, writeFileSync, existsSync: existsSy
26498
26522
  function composeTemplate(templatePath, targetDir, options) {
26499
26523
  const filesDir = join2(templatePath, "files");
26500
26524
  copySync(filesDir, targetDir);
26501
- const entryFiles = ts(join2(targetDir, "**/*.{ts,js,json,tsx,html,md}"));
26525
+ const envExamplePath = join2(targetDir, ".env.example");
26526
+ const envPath = join2(targetDir, ".env");
26527
+ if (existsSync2(envExamplePath) && !existsSync2(envPath)) {
26528
+ copySync(envExamplePath, envPath);
26529
+ }
26530
+ const entryFiles = ts(join2(targetDir, "**/*.{ts,js,json,tsx,html,md,env,env.example}"));
26502
26531
  entryFiles.forEach((file) => {
26503
26532
  let content = readFileSync2(file, "utf8");
26504
26533
  content = content.replace(/{{PROJECT_NAME}}/g, options.projectName);
@@ -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
+ });
@@ -6,5 +6,10 @@
6
6
  "lucide-react": "^0.300.0",
7
7
  "recharts": "^2.10.0"
8
8
  },
9
- "packageDevDependencies": {}
9
+ "packageDevDependencies": {},
10
+ "routeInfo": {
11
+ "path": "/admin",
12
+ "importFile": "./modules/admin/routes/admin.routes",
13
+ "exportName": "adminRoutes"
14
+ }
10
15
  }
@@ -5,5 +5,10 @@
5
5
  "packageDependencies": {
6
6
  "better-auth": "latest",
7
7
  "@better-auth/drizzle-adapter": "latest"
8
+ },
9
+ "routeInfo": {
10
+ "path": "/auth",
11
+ "importFile": "./modules/auth/routes/auth.routes",
12
+ "exportName": "authRoutes"
8
13
  }
9
14
  }
@@ -6,5 +6,10 @@
6
6
  "packageDependencies": {
7
7
  "stripe": "latest",
8
8
  "zod": "^3.22.4"
9
+ },
10
+ "routeInfo": {
11
+ "path": "/billing",
12
+ "importFile": "./modules/billing/routes/billing.routes",
13
+ "exportName": "billingRoutes"
9
14
  }
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmadubaidillah/core",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "The scaffolding engine and RTK-AI efficiency layer for DevForge.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",