🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

generate-react-cli

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generate-react-cli - npm Package Compare versions

Comparing version

to
1.6.1

{
"name": "generate-react-cli",
"version": "1.5.9",
"version": "1.6.1",
"description": "A simple React CLI to generate components instantly and more.",

@@ -26,3 +26,3 @@ "main": "src/index.js",

"chalk": "^2.4.2",
"commander": "^3.0.0",
"commander": "^3.0.2",
"deep-keys": "^0.5.0",

@@ -29,0 +29,0 @@ "esm": "^3.2.25",

@@ -10,5 +10,4 @@ # Generate React CLI

**_Few notes:_**
- The CLI assumes that your project uses [jest](https://github.com/facebook/jest) & [enzyme](https://github.com/airbnb/enzyme) for testing (This will be customizable in the future).
- The CLI also has an opinion on how files are structured within the project. We follow "[grouping by features](https://reactjs.org/docs/faq-structure.html#grouping-by-features-or-routes)."
**_Note:_**
- The CLI has an opinion on how files are structured within the project. We follow "[grouping by features](https://reactjs.org/docs/faq-structure.html#grouping-by-features-or-routes)."

@@ -15,0 +14,0 @@ ## Install

@@ -6,3 +6,5 @@ import chalk from 'chalk';

import componentCssTemplate from '../templates/components/componentCssTemplate';
import componentTestTemplate from '../templates/components/componentTestTemplate';
import componentTestDefaultTemplate from '../templates/components/componentTestDefaultTemplate';
import componentTestEnzymeTemplate from '../templates/components/componentTestEnzymeTemplate';
import componentTestTestingLibraryTemplate from '../templates/components/componentTestTestingLibraryTemplate';
import componentStoryTemplate from '../templates/components/componentStoryTemplate';

@@ -45,3 +47,3 @@

componentTemplates.push({
template: componentTestTemplate,
template: getTestingLibraryTemplate(componentConfig),
templateType: `Test "${componentName}.test.js"`,

@@ -75,1 +77,12 @@ componentPath: `${componentPathDir}/${componentName}.test.js`,

}
function getTestingLibraryTemplate(componentConfig) {
switch (componentConfig.test.library) {
case 'Enzyme':
return componentTestEnzymeTemplate;
case 'Testing Library':
return componentTestTestingLibraryTemplate;
default:
return componentTestDefaultTemplate;
}
}

@@ -23,3 +23,3 @@ import program from 'commander';

'Would you like to create a corresponding test file with this component?',
component.withTest
component.test.withTest
)

@@ -26,0 +26,0 @@ .option(

@@ -28,4 +28,10 @@ import { accessSync, constants, outputFileSync, readFileSync } from 'fs-extra';

{
type: 'list',
name: 'component.test.library',
message: 'What testing component library does your project use?',
choices: ['Enzyme', 'Testing Library', 'None'],
},
{
type: 'confirm',
name: 'component.withTest',
name: 'component.test.withTest',
message: 'Would you like to create a corresponding test file with each component you generate?',

@@ -32,0 +38,0 @@ },

@@ -8,6 +8,9 @@ {

},
"withTest": null,
"test": {
"library": null,
"withTest": null
},
"withStory": null,
"withLazy": null
}
}
}