1.0.0 • Published 7 years ago
react-styled-component-generator v1.0.0
React styled component generator
"Automate every single boring and repetitive tasks" -- DevOps Handbook
Create a styled component with test (Jest ready) including optionals story and style component
Create components based on the following structure:
src/components/new-component/index.jsxsrc/components/new-component/test.jsxsrc/components/new-component/story.js(optional)src/components/new-component/style.js(optional)
Usage
You can substitute yarn with npm
- Create any components type using prompts:
yarn create-componentnpm run create-component
- Create styled components interactively using:
yarn create-componentnpm run create-component
- Or without prompt:
yarn create-component <ComponentName> <stateless|class|pure> <targetDir> [styled] [story]npm run create-component <ComponentName> <stateless|class|pure> <targetDir> [styled] [story]
Examples
npx create-component -- --name PureComponent --directory src/components --comptype pure --styled true --story falsewill generate a pure component without a story boooknpx create-component avatar src/component/profile pure true truewill create a pure component<Avatar />insrc/component/profileincluding test and story files

Note: the template can generate unstyled component but you'll just have to remove styled component references. PR welcome for different handling templates with other conventions/libraries
1.0.0
7 years ago