NimblePhxGenTemplate

Project repository template to set up all public Phoenix projects at Nimble

Installation

Generate a new Phoenix project by using mix phx.new

mix phx.new ...

Adding nimble_phx_gen_template into mix.exs:

def deps do
  [
    {:nimble_phx_gen_template, "~> 2.2.0", only: :dev, runtime: false},
    ...
  ]
end

Then run mix do deps.get, deps.compile to install NimblePhxGenTemplate.

Note: NimblePhxGenTemplate is only working on a new Phoenix project, applying NimblePhxGenTemplate to an existing Phoenix project might not work as expected.

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
mix nimble.phx.gen.template --live # Apply the LiveView template

Requirements

NimblePhxGenTemplate has been developed and actively tested with:

Running NimblePhxGenTemplate currently requires:

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 3 variants:

2.2/ Phoenix project

The Phoenix project could be either a Web project or API project.

Aside from that, it could also be a Custom project, which contains the custom OTP app name or custom module name.

So it ends up with 6 project types:

Putting it all together, it is 8 variant test cases.

Release

Set the HEX_API_KEY as a Github secret (skip this step if it has been done).

The release process follows the Git flow.

Once a release/<version number> is created, to publish the new version to Hex.pm, the version number in the mix.ex file needs to be updated on the release branch before merging.

Once the release branch is merged into the master branch, Github Action will automatically publish the template to https://hex.pm/packages/nimble_phx_gen_template.

License

This project is Copyright (c) 2014-2021 Nimble. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

Nimble

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 or hire our team to help build your product.