Skip to content

Commit 7bd4849

Browse files
author
=
committed
Fix: Fixed NextJsPage bug
1 parent 354ee63 commit 7bd4849

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ mac@Macs-MBP~/D/react-app$ methane g -np pageName -ct server
231231
As you already know, in **NextJS** dynamic pages are pages whose content is determined by parameters included in the URL. For example _/product/1_ is a dynamic URL. Now Methane can also help you create dynamic pages. Usually, a dynamic page would be nested within a page. For example, I've a products page already _/products_, my dynamic page would most likely be productId. So using Methane, you can generate a dynamic page using the command below
232232

233233
```bash
234-
mac@Macs-MBP~/D/react-app$ methane g -ndp productId -sp /products
234+
mac@Macs-MBP~/D/react-app$ methane g -nid productId -sp /products
235235

236236
```
237237

238238
##### Command Arguments
239239

240-
1. **-npd** -npid (Next Dynamic Page) is the dynamic page name, which in this case is _productId_
240+
1. **-nid** -nid (Next Dynamic Page Id) is the dynamic page name, which in this case is _productId_
241241
2. **-sp** -sp is an optional parameter called (Start Page) which is indicates the folder to place the dynamic page in. You don't need to specify the default nextJS _/app_ when specifying the folder to place the dynamic page.
242242

243243
**Optionally, you can specify your nextJs page to be a server or client page** To do this, Simply add the **ct** flag, then you can specify server or client omitting the **ct** would generate a client page by default.

helpers/generators/generateNextJsDynamicPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const generatePage = async (
122122

123123
generateDynamicPageFile(
124124
dynamicId,
125-
generatePageFolder ? "index" : name,
125+
captitalizeWord(dynamicId),
126126
pageDirName,
127127
pageResolver,
128128
componentType

helpers/generators/generateNextJsPage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ export const generatePage = async (
107107
const generatePageFolder =
108108
readUserConfig.readConfig().generateFolder === "true";
109109

110-
const legitPageName: string = generatePageFolder ? "index" : name;
110+
//const legitPageName: string = generatePageFolder ? "index" : name;
111111

112112
let pageDirName = generatePageFolder
113-
? path.join(pagesDir, legitPageName)
113+
? path.join(pagesDir, name)
114114
: path.join(pagesDir);
115115

116116
/**
@@ -123,7 +123,7 @@ export const generatePage = async (
123123
*/
124124
if (startPage) {
125125
pageDirName = generatePageFolder
126-
? path.join(pagesDir + startPage, legitPageName)
126+
? path.join(pagesDir + startPage, name)
127127
: path.join(pagesDir + startPage);
128128
}
129129

0 commit comments

Comments
 (0)