ash_state_machine/mix.exs

180 lines
4.3 KiB
Elixir
Raw Normal View History

defmodule AshStateMachine.MixProject do
2023-04-22 05:43:36 +12:00
use Mix.Project
2023-09-15 15:18:09 +12:00
@version "0.2.2"
2023-04-22 05:43:36 +12:00
@description """
An Ash.Resource extension for building finite state machines
"""
def project do
[
app: :ash_state_machine,
2023-04-22 05:43:36 +12:00
version: @version,
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
package: package(),
aliases: aliases(),
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env()),
2023-04-23 12:51:01 +12:00
dialyzer: [plt_add_apps: [:ash, :mix]],
2023-04-22 05:43:36 +12:00
docs: docs(),
description: @description,
source_url: "https://github.com/ash-project/ash_state_machine",
homepage_url: "https://github.com/ash-project/ash_state_machine"
2023-04-22 05:43:36 +12:00
]
end
defp package do
[
name: :ash_state_machine,
2023-04-22 05:43:36 +12:00
licenses: ["MIT"],
files: ~w(lib .formatter.exs mix.exs README* LICENSE*
CHANGELOG* documentation),
links: %{
GitHub: "https://github.com/ash-project/ash_state_machine"
2023-04-22 05:43:36 +12:00
}
]
end
defp elixirc_paths(:test) do
elixirc_paths(:dev) ++ ["test/support"]
end
defp elixirc_paths(_) do
["lib"]
end
defp extras() do
"documentation/**/*.{md,cheatmd,livemd}"
2023-04-22 05:43:36 +12:00
|> Path.wildcard()
|> Enum.map(fn path ->
title =
path
2023-09-16 01:44:04 +12:00
|> Path.basename(".md")
|> Path.basename(".cheatmd")
|> Path.basename(".livemd")
2023-04-22 05:43:36 +12:00
|> String.split(~r/[-_]/)
2023-09-16 01:43:25 +12:00
|> Enum.map(&capitalize_first/1)
2023-04-22 05:43:36 +12:00
|> Enum.join(" ")
|> case do
"F A Q" ->
"FAQ"
other ->
other
end
{String.to_atom(path),
[
title: title
]}
end)
end
2023-09-16 01:43:25 +12:00
defp capitalize_first(string) do
[h | t] = String.graphemes(string)
String.capitalize(h) <> Enum.join(t)
end
2023-04-22 05:43:36 +12:00
defp groups_for_extras() do
[
Tutorials: [
~r'documentation/tutorials'
],
"How To": ~r'documentation/how_to',
Topics: ~r'documentation/topics',
DSLs: ~r'documentation/dsls'
]
2023-04-22 05:43:36 +12:00
end
defp docs do
[
main: "get-started-with-state-machines",
2023-04-22 05:43:36 +12:00
source_ref: "v#{@version}",
logo: "logos/small-logo.png",
extra_section: "GUIDES",
spark: [
extensions: [
%{
module: AshStateMachine,
name: "AshStateMachine",
2023-04-22 05:43:36 +12:00
target: "Ash.Resource",
type: "StateMachine Resource"
2023-04-22 05:43:36 +12:00
}
]
],
2023-04-23 19:03:29 +12:00
before_closing_body_tag: fn
:html ->
"""
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad: true})</script>
"""
_ ->
""
end,
2023-04-22 05:43:36 +12:00
extras: extras(),
groups_for_extras: groups_for_extras(),
groups_for_modules: [
2023-04-23 19:03:29 +12:00
Dsl: [
AshStateMachine
2023-04-22 05:43:36 +12:00
],
Introspection: [
AshStateMachine.Info,
AshStateMachine.Transition
],
Helpers: [
AshStateMachine.BuiltinChanges
],
2023-04-23 19:03:29 +12:00
Charts: [
AshStateMachine.Charts
2023-04-22 05:43:36 +12:00
],
Errors: [
~r/AshStateMachine.Errors/
],
2023-04-22 05:43:36 +12:00
Internals: ~r/.*/
]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:ash, "~> 2.7"},
# {:spark, ">= 1.1.22"},
{:spark, path: "../spark", override: true},
{:ex_doc, "~> 0.22", only: [:dev, :test], runtime: false},
{:ex_check, "~> 0.12.0", only: [:dev, :test]},
{:credo, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:dialyxir, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:sobelow, ">= 0.0.0", only: [:dev, :test], runtime: false},
{:git_ops, "~> 2.5.1", only: [:dev, :test]},
{:excoveralls, "~> 0.13.0", only: [:dev, :test]}
2023-04-22 05:43:36 +12:00
]
end
defp aliases do
[
sobelow: "sobelow --skip",
credo: "credo --strict",
docs: [
"spark.cheat_sheets",
"docs",
"ash.replace_doc_links",
"spark.cheat_sheets_in_search"
],
"spark.formatter": "spark.formatter --extensions AshStateMachine",
"spark.cheat_sheets": "spark.cheat_sheets --extensions AshStateMachine",
"spark.cheat_sheets_in_search": "spark.cheat_sheets_in_search --extensions AshStateMachine"
2023-04-22 05:43:36 +12:00
]
end
end