Skip to content

Commit b319c3d

Browse files
Merge pull request #35 from Adedoyin-Emmanuel/v1.4.1
V1.4.1
2 parents c4b8a29 + 7bd4849 commit b319c3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+396
-2208
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
dist

README.md

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,30 @@
1111

1212
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.
1313

14-
<p align="center">
15-
<img src="./assets/MethaneLogo.png" alt="Methane Logo" style="max-width: 100%; width: 100%; height:40%;">
16-
</p>
17-
1814
## What's New ❓
1915

20-
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.
2117

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.
2622

2723
## Installation 💿
2824

2925
To install **Methane-Cli**, run the following command. Note you've to install it as a global package.
3026
**Note** You've to init methane before using it in your project.
3127

3228
```bash
33-
# npm
3429
npm install -g methane-cli
30+
```
31+
32+
```bash
33+
bun install -g methane-cli
34+
```
3535

36+
```bash
37+
yarn add -g methane-cli
3638
```
3739

3840
## Usage 🚦
@@ -45,7 +47,7 @@ rg
4547

4648
```
4749

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 😛.
4951

5052
```bash
5153

@@ -55,6 +57,12 @@ methane init
5557

5658
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.
5759

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+
5866
## Commands
5967

6068
The following commands are available in **methane-cli**
@@ -91,7 +99,7 @@ To change the configurations, run the following command.
9199
To change the template to **tsx** run the following command.
92100

93101
```bash
94-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane c --template tsx
102+
mac@Macs-MBP~/D/react-app$ methane c --template tsx
95103

96104
```
97105

@@ -102,7 +110,7 @@ _jsx or tsx are the only options available_
102110
To change the component generation style, run the following command.
103111

104112
```bash
105-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane config -c arrow
113+
mac@Macs-MBP~/D/react-app$ methane config -c arrow
106114

107115
```
108116

@@ -113,7 +121,7 @@ _arrow or functional are the only options available_
113121
To change the page generation style, run the following command
114122

115123
```bash
116-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane config -p arrow
124+
mac@Macs-MBP~/D/react-app$ methane config -p arrow
117125

118126
```
119127

@@ -124,7 +132,7 @@ _arrow or functional are the only options available_
124132
To generate stylesheet file for components and pages, run the following command
125133

126134
```bash
127-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane config -gs true
135+
mac@Macs-MBP~/D/react-app$ methane config -gs true
128136

129137
```
130138

@@ -135,7 +143,7 @@ _true or false are the only options available_
135143
To generate a folder for components and pages, run the following command
136144

137145
```bash
138-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane config -gf true
146+
mac@Macs-MBP~/D/react-app$ methane config -gf true
139147

140148
```
141149

@@ -146,7 +154,7 @@ _true or false are the only options available_
146154
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**
147155

148156
```bash
149-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane config -r true
157+
mac@Macs-MBP~/D/react-app$ methane config -r true
150158

151159
```
152160

@@ -157,7 +165,7 @@ _true or false are the only options available_
157165
To change the stylesheet type for your components and pages, run the following command.
158166

159167
```bash
160-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane config -st css
168+
mac@Macs-MBP~/D/react-app$ methane config -st css
161169

162170
```
163171

@@ -170,14 +178,14 @@ With the new update, you can generate **React** or **NextJS** server or client c
170178
### Generating A React Component
171179

172180
```bash
173-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -c componentName
181+
mac@Macs-MBP~/D/react-app$ methane g -c componentName
174182

175183
```
176184

177185
### Generating A NextJS Component
178186

179187
```bash
180-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -nc componentName
188+
mac@Macs-MBP~/D/react-app$ methane g -nc componentName
181189

182190
```
183191

@@ -196,7 +204,7 @@ With the new update, you can generate **React** or **NextJS** server or client p
196204
### Generating A React Page
197205

198206
```bash
199-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -p pageName
207+
mac@Macs-MBP~/D/react-app$ methane g -p pageName
200208

201209
```
202210

@@ -205,7 +213,7 @@ This would create a new page according to the global configuration and add the p
205213
### Generating A NextJS Page
206214

207215
```bash
208-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -np pageName
216+
mac@Macs-MBP~/D/react-app$ methane g -np pageName
209217

210218
```
211219

@@ -214,7 +222,7 @@ This would generate a new page according to the configuration in your _/methane/
214222
**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.
215223

216224
```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
218226

219227
```
220228

@@ -223,19 +231,19 @@ doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -np pageName -ct server
223231
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
224232

225233
```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
227235

228236
```
229237

230238
##### Command Arguments
231239

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_
233241
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.
234242

235243
**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.
236244

237245
```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
239247

240248
```
241249

@@ -248,7 +256,7 @@ Added a new command **`list-config [ls]`**
248256
- `--list-config` or `-lc`: Lists all Methane configurations.
249257

250258
````bash
251-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane list-config
259+
mac@Macs-MBP~/D/react-app$ methane list-config
252260

253261
All configurations
254262
{
@@ -263,7 +271,7 @@ All configurations
263271

264272

265273
```bash
266-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane g -sw
274+
mac@Macs-MBP~/D/react-app$ methane g -sw
267275
268276
````
269277
@@ -286,7 +294,7 @@ _You don't have specify any name for the service-worker_
286294
If you are stuck or you want to learn more about the different configurations, run the following command.
287295
288296
```bash
289-
doyin@doyinHpLaptop:~/Desktop/react-app$ methane c --help
297+
mac@Macs-MBP~/D/react-app$ methane c --help
290298
291299
```
292300
@@ -296,7 +304,7 @@ doyin@doyinHpLaptop:~/Desktop/react-app$ methane c --help
296304
297305
## Contributing ❤️
298306
299-
If you'd like to contribute to **methane**, please follow these steps:
307+
If you'd like to contribute to **Methane**, please follow these steps:
300308

301309
1. Fork the repository
302310
2. Create a new branch
@@ -308,9 +316,9 @@ Please star this repo if you find it useful. Also share the good news with your
308316

309317
## License 🧐
310318

311-
**methane-cli** is licensed under the [MIT License](https://opensource.org/licenses/MIT).
319+
**Methane-Cli** is licensed under the [MIT License](https://opensource.org/licenses/MIT).
312320

313321
## Contibutors 👨‍
314322

315-
<img src="https://www.npmjs.com/npm-avatar/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdmF0YXJVUkwiOiJodHRwczovL3MuZ3JhdmF0YXIuY29tL2F2YXRhci82YjdmNjY1YjY5NzNlMTA5MDY5NWYxNGQ5ZTFjN2FlMT9zaXplPTQ5NiZkZWZhdWx0PXJldHJvIn0.VLsXZqAcYRo73KaG7EmkZtMv67-fHx-8x4Fo_nXv_b4" />
316-
<a target="_blank" href="https:adedoyin-emmanuel.netlify.app">Adedoyin Emmanuel Adeniyi</a>
323+
<a href="https://github.com/adedoyin-emmanuel"> <img src="https://www.npmjs.com/npm-avatar/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdmF0YXJVUkwiOiJodHRwczovL3MuZ3JhdmF0YXIuY29tL2F2YXRhci82YjdmNjY1YjY5NzNlMTA5MDY5NWYxNGQ5ZTFjN2FlMT9zaXplPTQ5NiZkZWZhdWx0PXJldHJvIn0.VLsXZqAcYRo73KaG7EmkZtMv67-fHx-8x4Fo_nXv_b4" style="border-radius:50%" width="30" height="30"/>
324+
</a>

bun.lockb

320 KB
Binary file not shown.

dist/helpers/generators/generateComponent.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

dist/helpers/generators/generateNextJsComponent.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)