Skip to content

Commit

Permalink
Merge pull request #129 from emqx/make-fmt
Browse files Browse the repository at this point in the history
feat: add fmt to plugin template
  • Loading branch information
zhongwencool authored Jul 19, 2024
2 parents b46f0c5 + 162f473 commit 7a2449a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ distclean:
.PHONY: rel
rel: $(REBAR)
$(REBAR) emqx_plugrel tar

.PHONY: fmt
fmt: $(REBAR)
@find . \( -name '*.app.src' -o \
-name '*.erl' -o \
-name '*.hrl' -o \
-name 'rebar.config' -o \
-name '*.eterm' -o \
-name '*.escript' \) \
-not -path '*/_build/*' \
-not -path '*/deps/*' \
-not -path '*/_checkouts/*' \
-type f \
| xargs | $(REBAR) fmt --verbose -w
6 changes: 6 additions & 0 deletions README_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ In a shell from this plugin's working directory execute `make rel` to have the p
```
_build/default/emqx_plugrel/emqx_plugin_template-<vsn>.tar.gz
```
## Format

Format all the files in your project by running:
```
make fmt
```

See [EMQX documentation](https://docs.emqx.com/en/enterprise/v5.0/extensions/plugins.html) for details on how to deploy custom plugins.
2 changes: 1 addition & 1 deletion emqx-plugin.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{description, "Another amazing EMQX plugin."},
{version, "1.0.0", "The release version of this plugin."},
{app_vsn, "0.1.0", "The erlang application vsn value."},
{emqx_vsn, "v5.6.1", "EMQX version to use as a dependency."},
{emqx_vsn, "v5.7.1", "EMQX version to use as a dependency."},
{license, "Apache-2.0", "Short identifier for license you want to distribute this plugin under."},
{author_website, "http://example.com", "A website with details about the author."},
{repo, "https://github.com/emqx/emqx-plugin-template", "Where to find the source code for this plugin."}
Expand Down
3 changes: 2 additions & 1 deletion rebar_template.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
]}.

{plugins, [
{emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.5.0"}}}
{emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.5.0"}}},
{erlfmt, "1.3.0"}
]}.

{erl_opts, [debug_info]}.
Expand Down

0 comments on commit 7a2449a

Please sign in to comment.