# NimblePhxGenTemplate
Project repository template to set up all public Phoenix projects at [Nimble](https://nimblehq.co/)
## Installation
```elixir
def deps do
[
{:nimble_phx_gen_template, git: "https://github.com/nimblehq/elixir-templates", branch: "master", only: :dev}
]
end
```
Then run `mix do deps.get, deps.compile` to install NimblePhxGenTemplate
## Usage
```
mix nimble.phx.gen.template -v # Print the version
mix nimble.phx.gen.template --web # Apply the Web template
mix nimble.phx.gen.template --api # Apply the API template
```
## Requirements
NimblePhxGenTemplate has been developed and actively tested with Elixir 1.11+, Erlang/OTP 23.1+ and Phoenix 1.5+. Running NimblePhxGenTemplate currently requires Elixir 1.11+, Erlang/OTP 23.1+ and Phoenix 1.5+.
## Contributing
We appreciate any contribution to NimblePhxGenTemplate.
### Test
NimblePhxGenTemplate is using Github Action, the workflow files are located under `.github/workflows/` folder, it's including the Template test and Variant test workflow.
#### 1/ Template test
All files are located under `test/` folder.
```
.
├── ...
├── test
│ ├── ...
│ ├── nimble.phx.gen.template
│ │ └── addons
│ │ │ ├── ...
│ │ │ ├── common_addon_test.exs
│ │ │ └── variants
│ │ │ │ └── api
│ │ │ │ │ ├── ...
│ │ │ │ │ └── api_addon_test.exs
│ │ │ │ └── web
│ │ │ │ │ ├── ...
│ │ │ │ │ └── web_addon_test.exs
```
#### 2/ Variant test
##### 2.1/ Variant
NimblePhxGenTemplate is supporting 2 variants:
- API
- Web
##### 2.2/ Phoenix project
The Phoenix project could be either a Web project or API project.
- Web project is including HTML and Webpack configuration, which was generated by `mix phx.new AppName`.
- API project is NOT including HTML and Webpack configuration, which was generated by `mix phx.new AppName --no-html --no-webpack`.
Aside from that, it could also be a Custom project, which contains the custom OTP app name or custom module name.
- `mix phx.new AppName --module=CustomModuleName`
- `mix phx.new AppName --app=custom_otp_app_name`
- `mix phx.new AppName --module=CustomModuleName --app=custom_otp_app_name`
So it ends up with 4 project types:
- Standard Web project (`mix phx.new AppName`)
- Custom Web project (`mix phx.new AppName --module=CustomModuleName --app=custom_otp_app_name`)
- Standard API project (`mix phx.new AppName --no-html --no-webpack`)
- Custom API project (`mix phx.new AppName --no-html --no-webpack --module=CustomModuleName --app=custom_otp_app_name`)
Putting it all together, it is 6 variant test cases.
- Applying the `API variant` to a `Standard Web project`
- Applying the `API variant` to a `Custom Web project`
- Applying the `API variant` to a `Standard API project`
- Applying the `API variant` to a `Custom API project`
- Applying the `Web variant` to a `Standard Web project`
- Applying the `Web variant` to a `Custom Web project`
## License
This project is Copyright (c) 2014-2020 Nimble. It is free software,
and may be redistributed under the terms specified in the [LICENSE] file.
[LICENSE]: /LICENSE
## About
![Nimble](https://assets.nimblehq.co/logo/dark/logo-dark-text-160.png)
This project is maintained and funded by Nimble.
We love open source and do our part in sharing our work with the community!
See [our other projects][community] or [hire our team][hire] to help build your product.
[community]: https://github.com/nimblehq
[hire]: https://nimblehq.co/