# Front End Central Angular2

Componentized FEC

## Initial Setup
    npm install
Retrieve the required modules such as typescript and webpack. Type definition is managed by `@types` and included in `tsconfig.json`.

    npm run build
Pack up this document site. If you are going to run 'npm run server' to host the app, this step is not required, and you don't have to re-run after each change, otherwise, re-run will be required.
If you are going to publish or contribute to existing/new component, this step is also not required.

    npm run server
Host the app locally on <a href="http://localhost:3000/">http://localhost:3000/</a>
    
    npm run server:hmr (deprecated)
Enable hot module replacement on server, for better experience, please visit <a href="http://localhost:3000/webpack-dev-server/">http://localhost:3000/webpack-dev-server/</a> instead.
Warning: HMR will not work on `doc/index.html`, which is the default page of doc app.

## Build Details
    npm run clean
This will clean all unnecessary files in `src/components`.

## Contributing

- run `npm run server`, which will compile typescript and serve the project page locally 
- you should have a server running on localhost:3000 serving the docs
- for better developing experience, it is highly recommended to use localhost:3000/webpack-dev-server/
- local server will be available when the log shows `webpack: bundle is now VALID.`
- create/update your components
- before publishment your component to npm, use webpack to pack up your component
- when you're done, make sure you publish the components that you updated to npm by doing
`npm run vpublish [component name]`
`ex. npm run vpublish fec-nav`

## Testing

    npm run build:test
Compile and output the test bundle to `/test/js` with `SpecRunner.html` in `/test`. The `SpecRunner` is only supported by `webpack-dev-server`.
Therefore, if you would like to run all the tests in the browser, `npm run server` is required.
All the tests can be executed at `http://localhost:3000/test/SpecRunner.html`

For Karma, you can simply run `karma start` from project root, and webpack will handle everything for you.

### Regenerating document HTML

Pandoc is required. Install Pandoc in OS X with `brew install pandoc`. Instructions for other systems are at [pandoc.org](http://pandoc.org/installing.html).

```bash
# From project root:
./pandoc-build.sh
```

This bash script iterates through component source directories and runs a simple conversion on each `README.md` document, outputting to `/doc/views/<component-name>/README.html`.
