generator-react-modules

0.0.7 • Public • Published

generator-react-modules NPM version Build Status Dependency Status Coverage percentage

Yeoman generator for react modules architecture

Installation

First, install Yeoman and generator-react-modules using npm (we assume you have pre-installed node.js). This generator augments an existing project and should be installed as a dev dependency.

npm install -g yo
cd ~/your/react/project
npm install --save-dev generator-react-modules

Usage

Module Generation
yo react-modules
yo react-modules:module
  • Your selections will be stored. This is useful if you are creating components right after creating the module. You can simply override it when moving on to the next module.
Component Generation
yo react-modules:component
  • Generates both a presentation and container component.
  • It is not required that you first create a module to create a component. The necessary folders will be created.
  • It is idiomatic to capitalize the first letter of your component. Thus, the generator takes care of that for you. If you don't want that, you'll have to rename the file yourself.
  • When creating a component, you'll be prompted about a conflict. This is simply the generator trying to append your new component to the index.js export list. Y should be the default and the option you want to have the append take place. There's no way to suppress this as far as I have found.
Presentation Component Generation
yo react-modules:presentation-component
  • Generates just a presentation component and appends to the index.js list of components.
Container Component Generation
yo react-modules:container-component
  • Generates just a container component and appends to the index.js list of components.
  • Don't include the Container suffix- this will be taken care of for you.
  • A container component assumes a presentation component, but that presentation component doesn't have to exist already (and should be created seperately if desired).

TODO

  • Fix tests- breaking on parse errors.
  • Add CI.
  • Add architecture references and reading to readme.
  • Add sample structure diagram to readme.

License

MIT © Rob Hilgefort

Package Sidebar

Install

npm i generator-react-modules

Weekly Downloads

1

Version

0.0.7

License

MIT

Last publish

Collaborators

  • rjhilgefort