Giter Site home page Giter Site logo

generator-react-redux's Introduction

React & Redux Generator

License

A Yeoman generator for React & Redux for projects vertically integrated.

Of those out there, the React and Redux templates have a horizontal structure for their projects. This means all of your elements belong in the same folder, i.e. your components go in a components folder.

This generator works for vertically integrated React and Redux projects. The sub-generator will create modules for you with a smaller version of the horizontal structure. Each module is self-contained, although there may be a base that is common to everything else.

This repo is copied from React/Flux Vertical generator, which I'm de-comissioning in favor of this one.

Installation

Yeoman

For this generator to work, Yeoman must be globally installed.

npm install -g yo

Then you can install this generator-react-redux-modules module. I do not maintain generator-react-redux.

npm install -g generator-react-redux-modules

Base Generator

Creates the base project. Loosely based off React-starter-kit.

yo react-redux-modules

This will compile base files, including the Source, and Tools folders. (tests pending)

Options

Option Description Default
-h, --help Print the generator's options and usage
--skip-cache Do not remember prompt answers Default: false
--skip-install Do not automatically install dependencies Default: false

Sub-generators

The sub generators assumes you already have a project up and running. They are to help you through developing new modules, components, etc.

Module

When you need to start creating new modules, simple use the sub-generator module.

yo react-redux-modules:module [options] <moduleName>

Within the module sub-generator, the following default files are generated for you. Replace with your own module name.

Options

Option Description Default
-h, --help Print the generator's options and usage
--skip-cache Do not remember prompt answers Default: false
--skip-install Do not automatically install dependencies Default: false

Arguments

Arguments Description Type Required
moduleName Name of the module String true

Examples

The following command will generate the following:

yo react-redux-modules:module auth
# Generates the auth folder with all necessary files

Component

If you want to create a component other modules depend on, this sub-generator will create the files needed for you.

Within the component sub-generator, the following default files are generated for you. Replace #{CommonComponentName} with your own module name.

.
└── src
    └── common
        └── components
             └── CommonComponentName
                 ├── CommonComponentName.js
                 ├── CommonComponentName.scss
                 └── package.json

Arguments

Arguments Description Type Required
componentName Name of the module String true
componentRoot Name of the module String true

Options

Option Description Default
-h, --help Print the generator's options and usage
--skip-cache Do not remember prompt answers Default: false
--skip-install Do not automatically install dependencies Default: false
--raw Use user input raw format for component name Default: false

Examples

The following command will generate the following:

yo react-redux-modules:component TextBox ./src/common/components --raw
# Generates the following:
.
└── src
    └── common
        └── components
             └── TextBox
                 ├── TextBox.js
                 ├── TextBox.scss
                 └── package.json

Action Test

If you want to generate an action test, for a known module, this sub-generator will help.

Within the component sub-generator, the following default files are generated for you.

Replace #{module} and #{action} with your own module and action names.

.
└── test
    └── unit
        └── module
             └── actions
                 └── action.spec.js

Arguments

Arguments Description Type Required
module Name of the module String true
action Name of the action String true

Examples

The following command will generate the following:

yo react-redux-modules:actionTests Analytics Partners

# Generates the following:
.
└── test
    └── unit
        └── Analytics
            └── actions
                └── Partners.spec.js

Contributing

Anyone and everyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the guidelines:

License

The code is available under the MIT license.

generator-react-redux's People

Contributors

greenkeeper[bot] avatar jermspeaks avatar ramirezd42 avatar vinniegarcia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

generator-react-redux's Issues

Support CamelCase Component Names

When writing the argument for component name in the sub-generator, component, please allow no change in the CamelCase formatting.

Tasks:

  • Folder name use CamelCase
  • File names use CamelCase
  • class name use CamelCase
  • import styles name use CamelCase
  • Filename in package.json use camelcase

Fresh generated app cannot run

npm start after generating app, error occurs:

> [email protected] start /Users/d/workspace/js/dllm
> babel-node tools/run start

/Users/d/workspace/js/dllm/node_modules/babel-core/lib/transformation/file/plugin-manager.js:159
      throw new ReferenceError(messages.get("pluginKeyCollision", key));
      ^

ReferenceError: The plugin "react.displayName" collides with another of the same name
    at PluginManager.validate (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/transformation/file/plugin-manager.js:159:13)
    at PluginManager.add (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/transformation/file/plugin-manager.js:213:10)
    at File.buildTransformers (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/transformation/file/index.js:237:21)
    at new File (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/transformation/file/index.js:139:10)
    at Pipeline.transform (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
    at Object.transformFileSync (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/api/node.js:137:37)
    at compile (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/api/register/node.js:132:20)
    at normalLoader (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/api/register/node.js:199:14)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/d/workspace/js/dllm/node_modules/babel-core/lib/api/register/node.js:216:7)
    at Module.load (module.js:344:32)

npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/Cellar/node/5.3.0/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.3.0
npm ERR! npm  v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `babel-node tools/run start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'babel-node tools/run start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the dllm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     babel-node tools/run start
npm ERR! You can get their info via:
npm ERR!     npm owner ls dllm
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/d/workspace/js/dllm/npm-debug.log

Remove camelcase for stylesheets

Stylesheet selects should use dash separated selectors than camel case selectors.

Example:

.eventDateFilter {}

// vs

.event-date-filter {}

Dummy div in components

Create a dummy div in the components with the className equal to the name argument. For: sub-generator component

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.