@ahmadubaidillah/core 1.1.8 → 1.1.9

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
@@ -26448,8 +26448,10 @@ async function installPlugin(pluginName, projectDir, options) {
26448
26448
  }
26449
26449
  }
26450
26450
  if (config.routeInfo) {
26451
- const appPath = join5(projectDir, "src", "app.tsx");
26452
- if (existsSync4(appPath)) {
26451
+ const appPathTsx = join5(projectDir, "src", "app.tsx");
26452
+ const appPathTs = join5(projectDir, "src", "app.ts");
26453
+ const appPath = existsSync4(appPathTsx) ? appPathTsx : existsSync4(appPathTs) ? appPathTs : null;
26454
+ if (appPath) {
26453
26455
  let appContent = readFileSync4(appPath, "utf8");
26454
26456
  const importStmt = `import { ${config.routeInfo.exportName} } from '${config.routeInfo.importFile}';
26455
26457
  `;
@@ -26459,9 +26461,17 @@ async function installPlugin(pluginName, projectDir, options) {
26459
26461
  const routeStmt = `api.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
26460
26462
  `;
26461
26463
  if (!appContent.includes(routeStmt)) {
26462
- const injectionPoint = "// [PLUGIN_ROUTES_INJECTION_POINT]";
26463
- appContent = appContent.replace(injectionPoint, `${injectionPoint}
26464
+ const marker = "// [PLUGIN_ROUTES_INJECTION_POINT]";
26465
+ const injectionRegex = /\/\/ \[PLUGIN_ROUTES_INJECTION_POINT\].*$/m;
26466
+ if (injectionRegex.test(appContent)) {
26467
+ appContent = appContent.replace(injectionRegex, `${marker}
26464
26468
  ${routeStmt}`);
26469
+ } else {
26470
+ appContent += `
26471
+ // Auto-injected route
26472
+ api.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
26473
+ `;
26474
+ }
26465
26475
  }
26466
26476
  writeFileSync2(appPath, appContent);
26467
26477
  }
@@ -5,5 +5,10 @@
5
5
  "packageDependencies": {
6
6
  "drizzle-orm": "latest"
7
7
  },
8
- "pluginDependencies": ["auth", "file_upload"]
8
+ "pluginDependencies": ["auth", "file_upload"],
9
+ "routeInfo": {
10
+ "path": "/cms",
11
+ "importFile": "./modules/cms/routes/cms.routes",
12
+ "exportName": "cmsRoutes"
13
+ }
9
14
  }
@@ -6,5 +6,10 @@
6
6
  "@hono/swagger-ui": "^0.4.0",
7
7
  "@hono/zod-openapi": "^0.15.1"
8
8
  },
9
- "packageDevDependencies": {}
9
+ "packageDevDependencies": {},
10
+ "routeInfo": {
11
+ "path": "/platform",
12
+ "importFile": "./modules/openapi/openapi.routes",
13
+ "exportName": "openApiApp"
14
+ }
10
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmadubaidillah/core",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "The scaffolding engine and RTK-AI efficiency layer for DevForge.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",