@ahmadubaidillah/cli 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/bin.js CHANGED
@@ -32399,8 +32399,10 @@ async function installPlugin(pluginName, projectDir, options) {
32399
32399
  }
32400
32400
  }
32401
32401
  if (config.routeInfo) {
32402
- const appPath = join7(projectDir, "src", "app.tsx");
32403
- if (existsSync6(appPath)) {
32402
+ const appPathTsx = join7(projectDir, "src", "app.tsx");
32403
+ const appPathTs = join7(projectDir, "src", "app.ts");
32404
+ const appPath = existsSync6(appPathTsx) ? appPathTsx : existsSync6(appPathTs) ? appPathTs : null;
32405
+ if (appPath) {
32404
32406
  let appContent = readFileSync4(appPath, "utf8");
32405
32407
  const importStmt = `import { ${config.routeInfo.exportName} } from '${config.routeInfo.importFile}';
32406
32408
  `;
@@ -32410,9 +32412,17 @@ async function installPlugin(pluginName, projectDir, options) {
32410
32412
  const routeStmt = `api.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
32411
32413
  `;
32412
32414
  if (!appContent.includes(routeStmt)) {
32413
- const injectionPoint = "// [PLUGIN_ROUTES_INJECTION_POINT]";
32414
- appContent = appContent.replace(injectionPoint, `${injectionPoint}
32415
+ const marker = "// [PLUGIN_ROUTES_INJECTION_POINT]";
32416
+ const injectionRegex = /\/\/ \[PLUGIN_ROUTES_INJECTION_POINT\].*$/m;
32417
+ if (injectionRegex.test(appContent)) {
32418
+ appContent = appContent.replace(injectionRegex, `${marker}
32415
32419
  ${routeStmt}`);
32420
+ } else {
32421
+ appContent += `
32422
+ // Auto-injected route
32423
+ api.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
32424
+ `;
32425
+ }
32416
32426
  }
32417
32427
  writeFileSync4(appPath, appContent);
32418
32428
  }
@@ -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
  }
@@ -23,7 +23,7 @@ app.get('/', (c) => {
23
23
  const api = new Hono();
24
24
  api.route('/users', userRoutes);
25
25
 
26
- // [PLUGIN_ROUTES_INJECTION_POINT] - Do not remove this comment
26
+ // [PLUGIN_ROUTES_INJECTION_POINT]
27
27
 
28
28
  app.route('/api', api);
29
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmadubaidillah/cli",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "The elite modular boilerplate engine for agentic applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "devforge-cli": "dist/bin.js"
17
17
  },
18
18
  "dependencies": {
19
- "@ahmadubaidillah/core": "^1.1.8",
19
+ "@ahmadubaidillah/core": "^1.1.9",
20
20
  "@inquirer/prompts": "latest",
21
21
  "chalk": "latest",
22
22
  "commander": "latest",