2017-03-31 15:49:50 +00:00
|
|
|
# Contributing
|
|
|
|
|
|
|
|
This document describes how to:
|
|
|
|
|
|
|
|
- Set up your dev environment
|
|
|
|
- Become familiar with [Elm](http://elm-lang.org/)
|
|
|
|
- Develop against AlertManager
|
|
|
|
|
|
|
|
## Dev Environment Setup
|
|
|
|
|
2017-05-12 14:49:32 +00:00
|
|
|
You can either use our default Docker setup or install all dev dependencies
|
|
|
|
locally. For the former you only need Docker installed, for the latter you need
|
|
|
|
to set the environment flag `NO_DOCKER` to `true` and have the following
|
|
|
|
dependencies installed:
|
|
|
|
|
|
|
|
- [Elm](https://guide.elm-lang.org/install.html#install)
|
|
|
|
- [Elm-Format](https://github.com/avh4/elm-format) is installed
|
|
|
|
|
|
|
|
In addition for easier development you
|
|
|
|
can [configure](https://guide.elm-lang.org/install.html#configure-your-editor)
|
|
|
|
your editor.
|
2017-03-31 15:49:50 +00:00
|
|
|
|
|
|
|
**All submitted elm code must be formatted with `elm-format`**. Install and
|
|
|
|
execute it however works best for you. We recommend having formatting the file
|
|
|
|
on save, similar to how many developers use `gofmt`.
|
|
|
|
|
|
|
|
If you prefer, there's a make target available to format all elm source files:
|
|
|
|
|
|
|
|
```
|
|
|
|
# make format
|
|
|
|
```
|
|
|
|
|
|
|
|
## Elm Resources
|
|
|
|
|
|
|
|
- The [Official Elm Guide](https://guide.elm-lang.org/) is a great place to
|
|
|
|
start. Going through the entire guide takes about an hour, and is a good
|
|
|
|
primer to get involved in our codebase. Once you've worked through it, you
|
|
|
|
should be able to start writing your feature with the help of the compiler.
|
|
|
|
- Check the [syntax reference](http://elm-lang.org/docs/syntax) when you need a
|
|
|
|
reminder of how the language works.
|
|
|
|
- Read up on [how to write elm code](http://elm-lang.org/docs/style-guide).
|
2017-05-12 14:49:32 +00:00
|
|
|
- Watch videos from the
|
|
|
|
latest [elm-conf](https://www.youtube.com/channel/UCOpGiN9AkczVjlpGDaBwQrQ)
|
2017-03-31 15:49:50 +00:00
|
|
|
- Learn how to use the debugger! Elm comes packaged with an excellent
|
|
|
|
[debugger](http://elm-lang.org/blog/the-perfect-bug-report). We've found this
|
|
|
|
tool to be invaluable in understanding how the app is working as we're
|
|
|
|
debugging behavior.
|
|
|
|
|
|
|
|
## Local development workflow
|
|
|
|
|
2017-06-07 20:38:39 +00:00
|
|
|
At the top level of this repo, follow the HA AlertManager instructions. Compile
|
|
|
|
the binary, then run with `goreman`. Add example alerts with the file provided
|
2017-05-12 14:49:32 +00:00
|
|
|
in the HA example folder. Then start the development server:
|
2017-03-31 15:49:50 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
# cd ui/app
|
2017-05-12 14:49:32 +00:00
|
|
|
# make dev-server
|
2017-03-31 15:49:50 +00:00
|
|
|
```
|
|
|
|
|
2017-06-07 20:38:39 +00:00
|
|
|
Your app should be available at `http://localhost:<port>`. Navigate to
|
|
|
|
`src/Main.elm`. Any changes to the file system are detected automatically,
|
|
|
|
triggering a recompile of the project.
|
2017-05-12 14:49:32 +00:00
|
|
|
|
2019-02-25 10:04:42 +00:00
|
|
|
## Committing changes
|
2017-05-12 14:49:32 +00:00
|
|
|
|
|
|
|
Before you commit changes, please run `make build-all` on the root level
|
2018-09-24 13:12:40 +00:00
|
|
|
Makefile. Please include `asset/*_vfsdata.go` in your commit.
|