npm package: @socialcare/generator-app
Description: A generator that scaffolds out social care web apps, routes, components, and action / reducers.
Author: Jonathan King
Latest version: 1.3.6

# @socialcare/generator-app
> A generator that scaffolds out code for social care web apps. Includes helpful generator for
setting up a template app. 

## Installation

First, install [Yeoman](http://yeoman.io) using [npm](https://www.npmjs.com/) (we assume you
have pre-installed [node.js](https://nodejs.org/) version >=8.3 <9.0).

```bash
npm install -g yo
npm install -g @socialcare/generator-app
```

## Generating a web app
This will scaffold out an isomorphic app with all the files needed to get up and running.

1. ` cd ` into your projects directory.
2. Run the yeoman SocialCare app generator and follow the onscreen prompts.
  ```bash
  $ yo @socialcare/app
  ```  

> The generator will copy all the files needed for a new SocialCare app and will also run npm
install. When the instillation is complete you're ready to run the app.
 
```bash
$ npm start
```  

#### Created files
```bash
.
├── /public/        <-- icons, cross domain policies
├── /src/           <-- All the application code
│   ├── /actions/
│   ├── /components/
│   ├── /constants/
│   ├── /core/
│   ├── /css/
│   ├── /public/
│   ├── /reducers/
│   ├── /routes/
│   ├── /store/
│   ├── client.js
│   ├── config.js
│   ├── config.test.js
│   └── server.js
├── /test/          <-- Helpers for testing
│   ├── README.md
│   └── test-helpers.js
├── /tools/         <-- All the build tooling stuff
│   ├── /lib/
│   ├── build.js
│   ├── bundle.js
│   ├── clean.js
│   ├── copy.js
│   ├── deploy.js
│   ├── postcss.config.js
│   ├── README.md
│   ├── render.js
│   ├── run.js
│   ├── runServer.js
│   ├── start.js
│   └── webpack.config.js
├── .babelrc.js
├── .editorconfig
├── .eslintrc.js
├── .flowconfig
├── .gitattributes
├── .gitignore
├── .stylelintrc.js
├── .travis.yml
├── Dockerfile
├── jest.config.js
├── package.json
└── README.md
```
## Generating a route
This will create a route that will work with the sc-ui- app structure initially generated by
this package. The route generator will add a folder with an index, component, and css file in
the routes directory. It will also add an entry for the new route in the `route/index.js` file.

> The generator will do its best but it's not perfect. It's important that you check the
created files for correctness. 

1. ` CD ` into the app you want to create a route on.
2. Run the yeoman SocialCare app generator with `:route`
  ```bash
  $ yo @socialcare/app:route
  ```
3. Follow the prompts

#### Created files
```bash
.
└── /src/
    └── /routes/
        ├── /{base path + route name kabab cased}/
        │   ├── {route name Pascal cased}.js
        │   ├── styles.css
        │   └── index.js
        └── index.js <-- Updated with new route info
```

## Generating a component
This will create a component that will work with the sc-ui- app structure initially generated by
this package. The component generator will add a folder with the component, test, and css file in
the components directory.

> The generator will do its best but it's not perfect. It's important that you check the
created files for correctness. 

1. ` CD ` into the app you want to create a component in.
2. Run the yeoman SocialCare app generator with `:component`
  ```bash
  $ yo @socialcare/app:component
  ```
3. Follow the prompts

#### Created files
```bash
.
└── /src/
    └── /components/
        └── /{base path + route name kabab cased}/
            ├── {component name Pascal cased}.js
            ├── {component name Pascal cased}.test.js
            └── styles.css
```

## Generating an action / reducer
This will create an action and reducer* that will work with the sc-ui- app structure initially
generated by this package. The action generator will add a files to the src/action and src/reducers 
folders it will also create constants for these actions.

> The generator will do its best but it's not perfect. It's important that you check the
created files for correctness. 

1. ` CD ` into the app you want to create a component in.
2. Run the yeoman SocialCare app generator with `:action`
  ```bash
  $ yo @socialcare/app:action
  ```
3. Follow the prompts

#### touched files
```bash
.
└── /src/
    ├── /constants/
    │   └── index.js <-- updated
    ├── /actions/
    │   ├── {action name Pascal cased}.js
    │   ├── {action name Pascal cased}.test.js
    │   └── index.js <-- updated
    └── /reducers/
        ├── {action name Pascal cased}.js
        ├── {action name Pascal cased}-error.js*
        ├── {action name Pascal cased}-status.js*
        ├── {action name Pascal cased}.test.js
        └── index.js <-- updated

```

(*) Notes files that may be created under some conditions.

## License

 © [Social Care](https://www.socialcare.com)