ash/mix.exs

348 lines
9.4 KiB
Elixir
Raw Normal View History

2019-10-03 16:08:36 +13:00
defmodule Ash.MixProject do
2020-06-02 17:51:13 +12:00
@moduledoc false
2019-10-03 16:08:36 +13:00
use Mix.Project
2019-12-05 04:18:00 +13:00
@description """
A resource declaration and interaction library. Built with pluggable data layers, and
designed to be used by multiple front ends.
"""
2023-12-23 15:10:25 +13:00
@version "2.17.17"
2020-06-01 17:23:33 +12:00
2019-10-03 16:08:36 +13:00
def project do
[
app: :ash,
2020-06-01 17:23:33 +12:00
version: @version,
2021-01-22 09:36:49 +13:00
elixir: "~> 1.11",
consolidate_protocols: Mix.env() != :test,
2019-10-03 16:08:36 +13:00
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
2019-12-05 04:16:34 +13:00
package: package(),
deps: deps(),
dialyzer: [plt_add_apps: [:mix, :mnesia, :earmark, :plug, :ex_unit]],
2019-12-06 07:45:02 +13:00
docs: docs(),
2020-06-02 15:37:50 +12:00
aliases: aliases(),
2019-12-05 04:18:00 +13:00
description: @description,
2019-12-05 04:16:34 +13:00
source_url: "https://github.com/ash-project/ash",
homepage_url: "https://github.com/ash-project/ash"
]
end
def application do
[
extra_applications: [:mnesia]
]
end
defp extras do
"documentation/**/*.{md,livemd,cheatmd}"
2022-08-19 06:15:41 +12:00
|> Path.wildcard()
|> Enum.map(fn path ->
title =
path
|> Path.basename(".md")
|> Path.basename(".livemd")
|> Path.basename(".cheatmd")
2022-08-19 06:15:41 +12:00
|> String.split(~r/[-_]/)
|> Enum.map_join(" ", &capitalize/1)
2022-08-19 06:15:41 +12:00
|> case do
"F A Q" ->
"FAQ"
other ->
other
end
{String.to_atom(path),
[
title: title,
default: title == "Get Started"
2022-08-19 06:15:41 +12:00
]}
end)
end
defp capitalize(string) do
string
|> String.split(" ")
|> Enum.map(fn string ->
[hd | tail] = String.graphemes(string)
String.capitalize(hd) <> Enum.join(tail)
end)
end
defp groups_for_extras do
[
Tutorials: [
"documentation/tutorials/get-started.md",
"documentation/tutorials/philosophy.md",
"documentation/tutorials/why-ash.md",
~r'documentation/tutorials'
],
"How To": ~r'documentation/how_to',
Topics: ~r'documentation/topics',
DSLs: ~r'documentation/dsls'
]
2022-08-19 06:15:41 +12:00
end
2020-06-02 17:51:13 +12:00
defp docs do
2019-12-06 07:45:02 +13:00
# The main page in the docs
[
2022-08-24 11:55:36 +12:00
main: "get-started",
source_ref: "v#{@version}",
logo: "logos/small-logo.png",
2020-07-10 01:25:48 +12:00
extra_section: "GUIDES",
2022-08-19 06:15:41 +12:00
extras: extras(),
groups_for_extras: groups_for_extras(),
2023-10-03 01:32:13 +13:00
before_closing_head_tag: fn type ->
if type == :html do
"""
2023-10-03 03:33:58 +13:00
<script>
if (location.hostname === "hexdocs.pm") {
2023-10-03 03:33:58 +13:00
var script = document.createElement("script");
script.src = "https://plausible.io/js/script.js";
script.setAttribute("defer", "defer")
script.setAttribute("data-domain", "ashhexdocs")
document.head.appendChild(script);
2023-10-03 03:33:58 +13:00
}
</script>
2023-10-03 01:32:13 +13:00
"""
end
end,
spark: [
extensions: [
%{
module: Ash.Resource.Dsl,
name: "Resource",
target: "Ash.Resource",
type: "Resource",
default_for_target?: true
},
%{
module: Ash.Api.Dsl,
name: "Api",
target: "Ash.Api",
type: "Api",
default_for_target?: true
},
%{
module: Ash.DataLayer.Ets,
name: "Ets",
target: "Ash.Resource",
type: "DataLayer"
},
%{
module: Ash.DataLayer.Mnesia,
name: "Mnesia",
target: "Ash.Resource",
type: "DataLayer"
},
%{
module: Ash.Policy.Authorizer,
name: "Policy Authorizer",
target: "Ash.Resource",
type: "Authorizer"
},
%{
module: Ash.Flow.Dsl,
name: "Flow",
target: "Ash.Flow",
type: "Flow",
default_for_target?: true
},
%{
module: Ash.Notifier.PubSub,
name: "PubSub",
target: "Ash.Resource",
type: "Notifier"
},
%{
module: Ash.Registry.Dsl,
name: "Registry",
target: "Ash.Registry",
type: "Registry",
default_for_target?: true
},
%{
module: Ash.Registry.ResourceValidations,
name: "Resource Validations",
type: "Extension",
target: "Ash.Registry"
}
],
mix_tasks: [
Charts: [
Mix.Tasks.Ash.GenerateFlowCharts
]
]
],
groups_for_modules: [
Extensions: [
Ash.Api,
Ash.Resource,
2022-08-24 11:55:36 +12:00
Ash.DataLayer.Ets,
Ash.DataLayer.Mnesia,
Ash.DataLayer.Simple,
Ash.Notifier.PubSub,
Ash.Policy.Authorizer,
Ash.Registry
2022-08-24 11:55:36 +12:00
],
Resources: [
Ash.Api,
2022-08-24 11:55:36 +12:00
Ash.Filter.TemplateHelpers,
Ash.Calculation,
Ash.Resource.Calculation.Builtins,
Ash.CodeInterface,
Ash.DataLayer,
Ash.Notifier,
Ash.Notifier.Notification,
Ash.Resource.ManualRead,
2023-01-04 03:10:53 +13:00
Ash.Resource.ManualCreate,
Ash.Resource.ManualUpdate,
Ash.Resource.ManualDestroy,
Ash.Resource.ManualRelationship,
Ash.Resource.Attribute.Helpers
2022-08-24 11:55:36 +12:00
],
Queries: [
2020-07-12 18:25:53 +12:00
Ash.Query,
2022-08-24 11:55:36 +12:00
Ash.Resource.Preparation,
Ash.Resource.Preparation.Builtins,
Ash.Query.Calculation,
Ash.Query.Aggregate
],
Changesets: [
2020-10-12 16:55:47 +13:00
Ash.Changeset,
2022-08-24 11:55:36 +12:00
Ash.Resource.Change,
Ash.Resource.Change.Builtins,
Ash.Resource.Validation,
Ash.Resource.Validation.Builtins
],
2022-08-24 11:55:36 +12:00
Authorization: [
Ash.Authorizer,
Ash.Policy.Check,
2022-09-08 07:03:09 +12:00
Ash.Policy.Check.Builtins,
2022-08-24 11:55:36 +12:00
Ash.Policy.FilterCheck,
Ash.Policy.FilterCheckWithContext,
2022-08-24 11:55:36 +12:00
Ash.Policy.SimpleCheck
2021-03-15 11:29:30 +13:00
],
2022-08-24 11:55:36 +12:00
Introspection: [
Ash.Api.Info,
Ash.Registry.Info,
Ash.Resource.Info,
Ash.Flow.Info,
Ash.Policy.Info,
Ash.DataLayer.Ets.Info,
Ash.DataLayer.Mnesia.Info,
Ash.Notifier.PubSub.Info
],
2022-08-24 11:55:36 +12:00
Utilities: [
Ash,
2023-03-21 16:11:55 +13:00
Ash.Expr,
2022-08-24 11:55:36 +12:00
Ash.Page,
Ash.Page.Keyset,
Ash.Page.Offset,
Ash.Filter,
Ash.Filter.Runtime,
Ash.Sort,
Ash.CiString,
2023-02-15 15:12:39 +13:00
Ash.Union,
2022-08-24 11:55:36 +12:00
Ash.UUID,
Ash.NotLoaded,
Ash.Changeset.ManagedRelationshipHelpers,
Ash.DataLayer.Simple,
Ash.Filter.Simple,
Ash.Filter.Simple.Not,
Ash.OptionsHelpers,
2022-11-16 10:47:06 +13:00
Ash.Resource.Builder,
Ash.Tracer
],
2022-08-24 11:55:36 +12:00
Testing: [
Ash.Generator,
Ash.Seed,
Ash.Test
2020-10-07 18:20:03 +13:00
],
2022-08-24 11:55:36 +12:00
Flow: [
Ash.Flow,
Ash.Flow.Executor,
Ash.Flow.Step,
Ash.Flow.Chart.Mermaid,
Ash.Flow.StepHelpers
2020-09-25 16:36:50 +12:00
],
Types: [
"Ash.Type",
~r/Ash.Type\./
],
2022-08-24 11:55:36 +12:00
Errors: [
Ash.Error,
~r/Ash.Error\./
],
2022-08-24 11:55:36 +12:00
Transformers: [~r/\.Transformers\./, Ash.Registry.ResourceValidations],
Internals: ~r/.*/
]
]
2019-12-06 07:45:02 +13:00
end
2019-12-05 04:16:34 +13:00
defp package do
[
2020-07-21 14:16:28 +12:00
name: :ash,
2019-12-05 04:16:34 +13:00
licenses: ["MIT"],
files: ~w(lib .formatter.exs mix.exs README* LICENSE*
CHANGELOG* documentation),
2019-12-05 04:16:34 +13:00
links: %{
GitHub: "https://github.com/ash-project/ash"
}
2019-10-03 16:08:36 +13:00
]
end
defp elixirc_paths(:test) do
["lib", "test/support"]
end
2019-11-29 19:54:11 +13:00
defp elixirc_paths(_), do: ["lib"]
2019-10-03 16:08:36 +13:00
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:spark, "~> 1.1 and >= 1.1.50"},
{:ecto, "~> 3.7"},
{:ets, "~> 0.8"},
2021-01-10 05:47:50 +13:00
{:decimal, "~> 2.0"},
{:picosat_elixir, "~> 0.2"},
feat: freeform expressions feat: validatiosn in actions feat: query arguments feat: add `Ash.Query.for_read/3` feat: return changeset with API errors feat: add case insensitive string `CiString`/`:ci_string` feat: support `context/1` and `arg/1` in filter templates feat: support targeting notifications with the `for` option feat: add `ago/2` query function feat: add basic arithmetic operators (+, *, -, /) feat: `sensitive?` option for attributes feat: `sensitive?` option for arguments feat: `private` arguments, which can’t be set using `for_<action>` feat: add `prevent_change` which will erase changes just before the changeset is committed feat: add `match?` validation that supports a custom error message feat: add `interval` type to support `ago/2` function feat: add `url_encoded_binary` type feat: add `function` type improvement: `changing?` is now a validation improvement: add `Transformer.get_persisted/3` improvement: add `api` field to `Notification` improvement: standardize errors, add `to_error_class` improvement: use `Comp` everywhere Improvement: use action on changeset if set by `for_<action_type>` improvement: `action_failed?` field on change sets improvement: remove ability for data layers to add operators (for now at least) Improvement: Changeset.apply_attributes/2 now returns an error tuple Improvement: add a bunch of new/informative errors improvement: runtime filter now uses left join logic (a naive implementation of it) improvement: support more filter templates in resources Improvement: basic/naive type system for operators/functions Fix: properly expand module aliases for options w/o compile time dependency chore(engine): track changeset changes for the request with `manage_changeset?: true`
2021-01-22 09:21:58 +13:00
{:comparable, "~> 1.0"},
2021-01-23 12:20:08 +13:00
{:jason, ">= 1.0.0"},
{:stream_data, "~> 0.6"},
2022-08-27 09:57:03 +12:00
{:telemetry, "~> 1.1"},
{:plug, ">= 0.0.0", optional: true},
{:earmark, "~> 1.4"},
2021-01-10 05:47:50 +13:00
# Dev/Test dependencies
{:ex_doc, github: "elixir-lang/ex_doc", only: [:dev, :test], runtime: false},
{:ex_check, "~> 0.12", 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", only: [:dev, :test]},
{:mix_test_watch, "~> 1.0", only: [:dev, :test], runtime: false},
{:benchee, "~> 1.1", only: [:dev, :test]},
{:doctor, "~> 0.21", only: [:dev, :test]}
]
2019-10-03 16:08:36 +13:00
end
2020-06-02 15:37:50 +12:00
2020-06-02 17:47:25 +12:00
defp aliases do
[
sobelow: "sobelow --skip",
credo: "credo --strict",
docs: [
"spark.cheat_sheets",
"docs",
"spark.replace_doc_links",
"spark.cheat_sheets_in_search"
],
"spark.cheat_sheets_in_search":
"spark.cheat_sheets_in_search --extensions Ash.Resource.Dsl,Ash.Api.Dsl,Ash.Flow.Dsl,Ash.Registry.Dsl,Ash.DataLayer.Ets,Ash.DataLayer.Mnesia,Ash.Notifier.PubSub,Ash.Policy.Authorizer",
"spark.formatter":
"spark.formatter --extensions Ash.Resource.Dsl,Ash.Api.Dsl,Ash.Flow.Dsl,Ash.Registry.Dsl,Ash.DataLayer.Ets,Ash.DataLayer.Mnesia,Ash.Notifier.PubSub,Ash.Policy.Authorizer",
"spark.cheat_sheets":
"spark.cheat_sheets --extensions Ash.Resource.Dsl,Ash.Api.Dsl,Ash.Flow.Dsl,Ash.Registry.Dsl,Ash.DataLayer.Ets,Ash.DataLayer.Mnesia,Ash.Notifier.PubSub,Ash.Policy.Authorizer"
2020-06-02 17:47:25 +12:00
]
2020-06-02 15:37:50 +12:00
end
2019-10-03 16:08:36 +13:00
end