# Suddenly CLI

[![CircleCI](https://circleci.com/gh/nathanhoad/suddenly-cli.svg?style=svg)](https://circleci.com/gh/nathanhoad/suddenly-cli)

Suddenly, you have an app!

Install globally:

`npm install -g suddenly-cli`

Then:

`suddenly new <project-name>`

It will create a new folder in the current directory called `<project-name>` and put your new app in there. An initial `npm install` and `npm run build` will be run for you.

You'll need to set up your own AWS credentials and set them up in the `.env`.


## Testing

First make sure your test database has been migrated. Then run `npm test` to run the full suite or `npm run lab <test>` to just run a specific tests.

## NPM Scripts

### Building & Running

`npm run build` builds the app.

`npm run build:run` builds the app and then runs the dev server.


### Migrations & Models

Run `npm run db:migrate` to run any pending migrations. `npm run db:rollback` will rollback the last group of migrations.

To generate migrations:

* `npm run generate:migration <name>`
* `npm run generate:model <name> -- [--no-model] [--no-migration]`

`npm run db:version` will give you the current database version.

`npm run db:schema [<table>]` will give you information about the current schema of the database.


### Redux

* `npm run generate:component <name> -- [--controlled] [--no-tests] [--no-style]`
* `npm run generate:reducer <name> -- [--no-tests]`
* `npm run generate:actions <name> -- [--no-tests]`


### Hapi/Server

* `npm run generate:routes <name> -- [--no-tests]`
* `npm run generate:resource <name>`
* `npm run generate:notification <name>` (notifications are for sending emails)


### Deploy

`npm run deploy` will attempt to push master to Heroku and run any migrations.
