@ahmadubaidillah/cli 1.1.8 → 1.1.10
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 +20 -6
- package/dist/plugins/admin-panel/plugin.config.json +2 -1
- package/dist/plugins/cms/plugin.config.json +6 -1
- package/dist/plugins/openapi/plugin.config.json +6 -1
- package/dist/templates/saas/files/src/app.tsx +3 -1
- package/dist/templates/saas/files/src/modules/users/repositories/user.repository.ts +11 -0
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -14932,7 +14932,8 @@ var init_plugin_loader = __esm(() => {
|
|
|
14932
14932
|
routeInfo: z.object({
|
|
14933
14933
|
path: z.string(),
|
|
14934
14934
|
importFile: z.string(),
|
|
14935
|
-
exportName: z.string()
|
|
14935
|
+
exportName: z.string(),
|
|
14936
|
+
type: z.enum(["api", "ui"]).default("api")
|
|
14936
14937
|
}).optional()
|
|
14937
14938
|
});
|
|
14938
14939
|
});
|
|
@@ -32399,20 +32400,33 @@ async function installPlugin(pluginName, projectDir, options) {
|
|
|
32399
32400
|
}
|
|
32400
32401
|
}
|
|
32401
32402
|
if (config.routeInfo) {
|
|
32402
|
-
const
|
|
32403
|
-
|
|
32403
|
+
const appPathTsx = join7(projectDir, "src", "app.tsx");
|
|
32404
|
+
const appPathTs = join7(projectDir, "src", "app.ts");
|
|
32405
|
+
const appPath = existsSync6(appPathTsx) ? appPathTsx : existsSync6(appPathTs) ? appPathTs : null;
|
|
32406
|
+
if (appPath) {
|
|
32404
32407
|
let appContent = readFileSync4(appPath, "utf8");
|
|
32405
32408
|
const importStmt = `import { ${config.routeInfo.exportName} } from '${config.routeInfo.importFile}';
|
|
32406
32409
|
`;
|
|
32407
32410
|
if (!appContent.includes(config.routeInfo.importFile)) {
|
|
32408
32411
|
appContent = importStmt + appContent;
|
|
32409
32412
|
}
|
|
32410
|
-
const
|
|
32413
|
+
const isUI = config.routeInfo.type === "ui";
|
|
32414
|
+
const targetInstance = isUI ? "app" : "api";
|
|
32415
|
+
const marker = isUI ? "// [PLUGIN_UI_INJECTION_POINT]" : "// [PLUGIN_ROUTES_INJECTION_POINT]";
|
|
32416
|
+
const injectionRegex = new RegExp(`${marker.replace("[", "\\[").replace("]", "\\]")}.*$`, "m");
|
|
32417
|
+
const routeStmt = `${targetInstance}.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
|
|
32411
32418
|
`;
|
|
32412
32419
|
if (!appContent.includes(routeStmt)) {
|
|
32413
|
-
|
|
32414
|
-
|
|
32420
|
+
if (injectionRegex.test(appContent)) {
|
|
32421
|
+
appContent = appContent.replace(injectionRegex, `${marker}
|
|
32415
32422
|
${routeStmt}`);
|
|
32423
|
+
} else {
|
|
32424
|
+
const fallbackInstance = appContent.includes("const api =") ? "api" : "app";
|
|
32425
|
+
appContent += `
|
|
32426
|
+
// Auto-injected route
|
|
32427
|
+
${fallbackInstance}.route('${config.routeInfo.path}', ${config.routeInfo.exportName});
|
|
32428
|
+
`;
|
|
32429
|
+
}
|
|
32416
32430
|
}
|
|
32417
32431
|
writeFileSync4(appPath, appContent);
|
|
32418
32432
|
}
|
|
@@ -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
|
}
|
|
@@ -19,11 +19,13 @@ app.get('/', (c) => {
|
|
|
19
19
|
return c.html(<LandingPage projectName="{{PROJECT_NAME}}" />);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
// [PLUGIN_UI_INJECTION_POINT]
|
|
23
|
+
|
|
22
24
|
// Feature Routes (Registry)
|
|
23
25
|
const api = new Hono();
|
|
24
26
|
api.route('/users', userRoutes);
|
|
25
27
|
|
|
26
|
-
// [PLUGIN_ROUTES_INJECTION_POINT]
|
|
28
|
+
// [PLUGIN_ROUTES_INJECTION_POINT]
|
|
27
29
|
|
|
28
30
|
app.route('/api', api);
|
|
29
31
|
|
|
@@ -6,6 +6,17 @@ export class UserRepository {
|
|
|
6
6
|
|
|
7
7
|
async findById(id: string): Promise<User | null> {
|
|
8
8
|
console.log(`[UserRepository] Finding user by id: ${id}`);
|
|
9
|
+
|
|
10
|
+
// Seed/Mock fallback for the demo user
|
|
11
|
+
if (id === '1') {
|
|
12
|
+
return {
|
|
13
|
+
id: '1',
|
|
14
|
+
name: 'System Administrator',
|
|
15
|
+
email: 'admin@devforge.dev',
|
|
16
|
+
createdAt: new Date(),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
return null;
|
|
10
21
|
}
|
|
11
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahmadubaidillah/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
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.
|
|
19
|
+
"@ahmadubaidillah/core": "^1.1.10",
|
|
20
20
|
"@inquirer/prompts": "latest",
|
|
21
21
|
"chalk": "latest",
|
|
22
22
|
"commander": "latest",
|