You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-33Lines changed: 41 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,28 +11,30 @@
11
11
12
12
Methane is a **CLI** tool that helps developers easily create **React components, pages or NextJS components, pages, dynamic pages and service worker files** with boilerplate codes. It also comes with extra configration that allows you choose either **JavaScript** or **TypeScript** templates.
The new major version **2.0.0**comes with support for **NextJS**. This is a game changer for NextJs developers, with **Methane** you can easily generate your components from the command line and bingo 🚀
16
+
The patch version **1.4.1**aims to fix issues related to the **components and pages** generation.
21
17
22
-
1.Support for **NextJS**
23
-
2.Migrated codebase from **JS** to **TS**
24
-
3.Cleaner CLI Interface
25
-
4.Customize your project based on your local configuration.
18
+
1.React Components and Pages as well as NextJs Components, Pages name default to `index.jsx` or `index.tsx` if **generateFolder** configuration is specified. This makes **components and pages** import cleaner and easier to understand. For example, if you generate a component called `Button`, the generated component path would be `Button/index.jsx` or `Button/index.tsx` and you can import it like this `import Button from './components/Button'`. Unlike before where you would have to import it like this `import Button from './components/Button/Button'`.
19
+
2.Fixed component and pages capitalization issue. In previous versions of **Methane**, if you generate a component called `button`, the file name remains `button` but the generated component would be `button` instead of `Button`. This has been fixed in this version.
20
+
3.Gracefully handled potential error that might occur when generating pages or components.
21
+
4.Added a new argument `-d` or `--default` to `methane init` command. This allows developers to easily intialize **Methane** with the default configuration without being prompted to answer questions. This is useful when you want to quickly initialize **Methane** in a new project. **Note** You can always update the **Methane**configuration by running `methane config` command.
26
22
27
23
## Installation 💿
28
24
29
25
To install **Methane-Cli**, run the following command. Note you've to install it as a global package.
30
26
**Note** You've to init methane before using it in your project.
31
27
32
28
```bash
33
-
# npm
34
29
npm install -g methane-cli
30
+
```
31
+
32
+
```bash
33
+
bun install -g methane-cli
34
+
```
35
35
36
+
```bash
37
+
yarn add -g methane-cli
36
38
```
37
39
38
40
## Usage 🚦
@@ -45,7 +47,7 @@ rg
45
47
46
48
```
47
49
48
-
This would show a welcome message with information about the tool. Then you need to run the init command. This would help you to configure methane to your taste. 😛
50
+
This would show a welcome message with information about the tool. Then you need to run the init command. This would help you to configure methane to your taste 😛.
49
51
50
52
```bash
51
53
@@ -55,6 +57,12 @@ methane init
55
57
56
58
This would prompt you to answer some questions and a config file will be created. Note you can't use **Methane** if you don't have the config file.
57
59
60
+
Optionally, you can also add the `-d` or `--default` argument to skip the prompt and use the default configuration.
61
+
62
+
```bash
63
+
methane init --default
64
+
```
65
+
58
66
## Commands
59
67
60
68
The following commands are available in **methane-cli**
@@ -91,7 +99,7 @@ To change the configurations, run the following command.
91
99
To change the template to **tsx** run the following command.
92
100
93
101
```bash
94
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane c --template tsx
102
+
mac@Macs-MBP~/D/react-app$ methane c --template tsx
95
103
96
104
```
97
105
@@ -102,7 +110,7 @@ _jsx or tsx are the only options available_
102
110
To change the component generation style, run the following command.
@@ -146,7 +154,7 @@ _true or false are the only options available_
146
154
To register the generated pages in your **App.js or App.jsx or App.tsx or App.ts** file, run the following command. This is strictly or **React** and not **NextJS**
@@ -170,14 +178,14 @@ With the new update, you can generate **React** or **NextJS** server or client c
170
178
### Generating A React Component
171
179
172
180
```bash
173
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -c componentName
181
+
mac@Macs-MBP~/D/react-app$ methane g -c componentName
174
182
175
183
```
176
184
177
185
### Generating A NextJS Component
178
186
179
187
```bash
180
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -nc componentName
188
+
mac@Macs-MBP~/D/react-app$ methane g -nc componentName
181
189
182
190
```
183
191
@@ -196,7 +204,7 @@ With the new update, you can generate **React** or **NextJS** server or client p
196
204
### Generating A React Page
197
205
198
206
```bash
199
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -p pageName
207
+
mac@Macs-MBP~/D/react-app$ methane g -p pageName
200
208
201
209
```
202
210
@@ -205,7 +213,7 @@ This would create a new page according to the global configuration and add the p
205
213
### Generating A NextJS Page
206
214
207
215
```bash
208
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -np pageName
216
+
mac@Macs-MBP~/D/react-app$ methane g -np pageName
209
217
210
218
```
211
219
@@ -214,7 +222,7 @@ This would generate a new page according to the configuration in your _/methane/
214
222
**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.
215
223
216
224
```bash
217
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -np pageName -ct server
225
+
mac@Macs-MBP~/D/react-app$ methane g -np pageName -ct server
218
226
219
227
```
220
228
@@ -223,19 +231,19 @@ doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -np pageName -ct server
223
231
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
224
232
225
233
```bash
226
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -ndp productId -sp /products
234
+
mac@Macs-MBP~/D/react-app$ methane g -nid productId -sp /products
227
235
228
236
```
229
237
230
238
##### Command Arguments
231
239
232
-
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_
233
241
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.
234
242
235
243
**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.
236
244
237
245
```bash
238
-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -ndp productId -sp /products -ct server
246
+
mac@Macs-MBP~/D/react-app$ methane g -ndp productId -sp /products -ct server
239
247
240
248
```
241
249
@@ -248,7 +256,7 @@ Added a new command **`list-config [ls]`**
248
256
-`--list-config` or `-lc`: Lists all Methane configurations.
0 commit comments