generate-react-cli
Advanced tools
Comparing version
@@ -5,2 +5,14 @@ # Changelog | ||
## [3.0.0](https://github.com/arminbro/generate-react-cli/compare/v2.0.2...v3.0.0) (2019-12-14) | ||
### ⚠ BREAKING CHANGES | ||
- Update the way option values are passed in the component command. For | ||
example if you wanted or didn't want a corresponding test file, the old | ||
syntax looked like this: --withTest or --no-withTest. Now with the new | ||
syntax you just do this --withTest=true or --withTest=false this applies | ||
to all the other component options (withStyle, withStory, withLazy). | ||
- 💄 Update component command options ([c870c7c](https://github.com/arminbro/generate-react-cli/commit/c870c7c5544640e23848f4f22b883e2d0ee755e4)) | ||
### [2.0.2](https://github.com/arminbro/generate-react-cli/compare/v2.0.1...v2.0.2) (2019-12-13) | ||
@@ -7,0 +19,0 @@ |
{ | ||
"name": "generate-react-cli", | ||
"version": "2.0.2", | ||
"version": "3.0.0", | ||
"description": "A simple React CLI to generate components instantly and more.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/arminbro/generate-react-cli", |
@@ -6,3 +6,3 @@ # Generate React CLI | ||
<p align="center"><img src="docs/assets/component-cmd.gif?raw=true"/></p> | ||
<p align="center"><img src="https://raw.githubusercontent.com/arminbro/generate-react-cli/master/docs/assets/component-cmd.gif?raw=true"/></p> | ||
@@ -83,6 +83,6 @@ ## Why? | ||
You can also override the generate-react-cli default config options for one-off commands. So for example, let's say you have set **withTest** to be `true` in your generate-react-cli config file. You can override it for that one-off command like this: | ||
You can also override some of the generate-react-cli default config options for one-off commands. So for example, let's say you have set **withTest** to be `true` in your generate-react-cli config file. You can override it for that one-off command like this: | ||
``` | ||
npx generate-react-cli c Box --no-withTest | ||
npx generate-react-cli c Box --withTest=false | ||
``` | ||
@@ -93,3 +93,3 @@ | ||
``` | ||
npx generate-react-cli c Box --withTest | ||
npx generate-react-cli c Box --withTest=true | ||
``` | ||
@@ -99,16 +99,51 @@ | ||
| Parameter | Description | | ||
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **--path** | Value of the path where you want the component to be generated in (e.g. **src/pages**). | | ||
| **--withStyle** | Creates a corresponding stylesheet file with this component. | | ||
| **--no-withStyle** | Creates component without the stylesheet file. | | ||
| **--withTest** | Creates a corresponding test file with this component. | | ||
| **--no-withTest** | Creates a component without the test file. | | ||
| **--withStory** | Creates a corresponding story file with this component. | | ||
| **--no-withStory** | Creates component without the story file. | | ||
| **--withLazy** | Creates a corresponding lazy file (a file that lazy-loads your component out of the box and enables [code splitting](https://reactjs.org/docs/code-splitting.html#code-splitting)) with this component. | | ||
| **--no-withLazy** | Creates a component without the lazy file. | | ||
<table> | ||
<tr align="left"> | ||
<th>Options</th> | ||
<th>Description</th> | ||
<th>Value Type</th> | ||
</tr> | ||
<tr> | ||
<td width="20%"><b>--path</b></td> | ||
<td width="60%"> | ||
Value of the path where you want the component to be generated in (e.g. <b>src/pages</b>). | ||
</td> | ||
<td width="20%">String</td> | ||
</tr> | ||
<tr> | ||
<td width="20%"><b>--withStyle</b></td> | ||
<td width="60%"> | ||
Creates a corresponding stylesheet file with this component. | ||
</td> | ||
<td width="20%">Boolean</td> | ||
</tr> | ||
<tr> | ||
<td width="20%"><b>--withTest</b></td> | ||
<td width="60%"> | ||
Creates a corresponding test file with this component. | ||
</td> | ||
<td width="20%">Boolean</td> | ||
</tr> | ||
<tr> | ||
<td width="20%"><b>--withStory</b></td> | ||
<td width="60%"> | ||
Creates a corresponding story file with this component. | ||
</td> | ||
<td width="20%">Boolean</td> | ||
</tr> | ||
<tr> | ||
<td width="20%"><b>--withLazy</b></td> | ||
<td width="60%"> | ||
Creates a corresponding lazy file (a file that lazy-loads your component out of the box and enables <a href="https://reactjs.org/docs/code-splitting.html#code-splitting">code splitting</a>) with this component. | ||
</td> | ||
<td width="20%">Boolean</td> | ||
</tr> | ||
</table> | ||
## License | ||
Generate React CLI is open source software [licensed as MIT](https://github.com/arminbro/generate-react-cli/blob/master/LICENSE). |
@@ -31,3 +31,6 @@ const chalk = require('chalk'); | ||
if (cmd[componentTemplateType] || componentTemplateType === componentTemplateTypes.COMPONENT) { | ||
if ( | ||
(cmd[componentTemplateType] && cmd[componentTemplateType].toString() === 'true') || | ||
componentTemplateType === componentTemplateTypes.COMPONENT | ||
) { | ||
const template = getComponentTemplate(cmd, cliConfigFile, componentName, componentTemplateType); | ||
@@ -34,0 +37,0 @@ |
@@ -21,15 +21,7 @@ const program = require('commander'); | ||
.option('-p, --path <path>', 'The path where the component will get genereted in.', component.path) | ||
.option('--withStyle <withStyle>', 'With corresponding stylesheet file.', component.css.withStyle) | ||
.option('--withTest <withTest>', 'With corresponding test file.', component.test.withTest) | ||
.option('--withStory <withStory>', 'With corresponding story file.', component.withStory) | ||
.option('--withLazy <withLazy>', 'With corresponding lazy file.', component.withLazy) | ||
.option('--withStyle', 'With corresponding test file.', component.css.withStyle) | ||
.option('--no-withStyle', 'Without corresponding test file.') | ||
.option('--withTest', 'With corresponding test file.', component.test.withTest) | ||
.option('--no-withTest', 'Without corresponding test file.') | ||
.option('--withStory', 'With corresponding story file.', component.withStory) | ||
.option('--no-withStory', 'Without corresponding story file.') | ||
.option('--withLazy', 'With corresponding lazy file.', component.withLazy) | ||
.option('--no-withLazy', 'Without corresponding lazy file.') | ||
.action((componentName, cmd) => generateComponent(cmd, cliConfigFile, componentName)) | ||
@@ -36,0 +28,0 @@ .action(() => { |
@@ -95,3 +95,3 @@ const chalk = require('chalk'); | ||
chalk.cyan( | ||
'A config file ("generate-react-cli.json") has successfully created on the root level of your project.' | ||
'The "generate-react-cli.json" config file has been successfully created on the root level of your project.' | ||
) | ||
@@ -98,0 +98,0 @@ ); |
146
31.53%32864
-1.9%503
-0.2%