generate-react-cli 7.3.0 → 7.4.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generate-react-cli",
3
- "version": "7.3.0",
3
+ "version": "7.4.0",
4
4
  "description": "A simple React CLI to generate components instantly and more.",
5
5
  "repository": "https://github.com/arminbro/generate-react-cli",
6
6
  "bugs": "https://github.com/arminbro/generate-react-cli/issues",
package/readme.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # Generate React CLI
2
2
 
3
- [![dependencies](https://david-dm.org/arminbro/generate-react-cli.svg)](https://david-dm.org/arminbro/generate-react-cli)
4
3
  [![License](https://img.shields.io/npm/l/express.svg)](https://github.com/arminbro/generate-react-cli/blob/master/LICENSE)
5
4
 
6
5
  <p align="center">
@@ -159,6 +158,14 @@ Otherwise, if you don't pass any options, it will just use the default values th
159
158
  <td width="20%">Boolean</td>
160
159
  <td width="20%"><code>false<code></td>
161
160
  </tr>
161
+ <tr>
162
+ <td width="20%"><b>--flat</b></td>
163
+ <td width="60%">
164
+ Generate the files in the mentioned path insted of creating new folder for it
165
+ </td>
166
+ <td width="20%">Boolean</td>
167
+ <td width="20%"><code>false<code></td>
168
+ </tr>
162
169
  </table>
163
170
 
164
171
  ### Custom component types:
@@ -18,7 +18,8 @@ function initGenerateComponentCommand(args, cliConfigFile, program) {
18
18
  '--type <type>',
19
19
  'You can pass a component type that you have configured in your GRC config file.',
20
20
  'default'
21
- );
21
+ )
22
+ .option('-f, --flat', 'Generate the files in the mentioned path insted of creating new folder for it', false);
22
23
 
23
24
  // Dynamic component command option defaults.
24
25
 
@@ -127,7 +127,7 @@ function componentTemplateGenerator({ cmd, componentName, cliConfigFile }) {
127
127
  }
128
128
 
129
129
  return {
130
- componentPath: `${cmd.path}/${componentName}/${filename}`,
130
+ componentPath: `${cmd.path}${cmd.flat ? '' : `/${componentName}`}/${filename}`,
131
131
  filename,
132
132
  template,
133
133
  };
@@ -162,7 +162,7 @@ function componentStyleTemplateGenerator({ cliConfigFile, cmd, componentName })
162
162
  }
163
163
 
164
164
  return {
165
- componentPath: `${cmd.path}/${componentName}/${filename}`,
165
+ componentPath: `${cmd.path}${cmd.flat ? '' : `/${componentName}`}/${filename}`,
166
166
  filename,
167
167
  template,
168
168
  };
@@ -201,7 +201,7 @@ function componentTestTemplateGenerator({ cliConfigFile, cmd, componentName }) {
201
201
  }
202
202
 
203
203
  return {
204
- componentPath: `${cmd.path}/${componentName}/${filename}`,
204
+ componentPath: `${cmd.path}${cmd.flat ? '' : `/${componentName}`}/${filename}`,
205
205
  filename,
206
206
  template,
207
207
  };
@@ -233,7 +233,7 @@ function componentStoryTemplateGenerator({ cliConfigFile, cmd, componentName })
233
233
  }
234
234
 
235
235
  return {
236
- componentPath: `${cmd.path}/${componentName}/${filename}`,
236
+ componentPath: `${cmd.path}${cmd.flat ? '' : `/${componentName}`}/${filename}`,
237
237
  filename,
238
238
  template,
239
239
  };
@@ -265,7 +265,7 @@ function componentLazyTemplateGenerator({ cmd, componentName, cliConfigFile }) {
265
265
  }
266
266
 
267
267
  return {
268
- componentPath: `${cmd.path}/${componentName}/${filename}`,
268
+ componentPath: `${cmd.path}${cmd.flat ? '' : `/${componentName}`}/${filename}`,
269
269
  filename,
270
270
  template,
271
271
  };
@@ -303,7 +303,7 @@ Please make sure you're pointing to the right custom template path in your gener
303
303
  filename = customTemplateFilename;
304
304
 
305
305
  return {
306
- componentPath: `${cmd.path}/${componentName}/${filename}`,
306
+ componentPath: `${cmd.path}${cmd.flat ? '' : `/${componentName}`}/${filename}`,
307
307
  filename,
308
308
  template,
309
309
  };