@mandujs/core 0.4.2 → 0.4.3
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/package.json +1 -1
- package/src/generator/templates.ts +11 -3
package/package.json
CHANGED
|
@@ -122,7 +122,7 @@ function computeSlotImportPath(slotModule: string, fromDir: string): string {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export function generatePageComponent(route: RouteSpec): string {
|
|
125
|
-
const pageName =
|
|
125
|
+
const pageName = toPascalCase(route.id);
|
|
126
126
|
return `// Generated by Mandu - DO NOT EDIT DIRECTLY
|
|
127
127
|
// Route ID: ${route.id}
|
|
128
128
|
// Pattern: ${route.pattern}
|
|
@@ -143,6 +143,14 @@ export default function ${pageName}Page({ params }: Props): React.ReactElement {
|
|
|
143
143
|
`;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Convert string to PascalCase (handles kebab-case, snake_case)
|
|
148
|
+
* "todo-page" → "TodoPage"
|
|
149
|
+
* "user_profile" → "UserProfile"
|
|
150
|
+
*/
|
|
151
|
+
function toPascalCase(str: string): string {
|
|
152
|
+
return str
|
|
153
|
+
.split(/[-_]/)
|
|
154
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
155
|
+
.join("");
|
|
148
156
|
}
|