Current section
Files
Jump to
Current section
Files
mix.exs
defmodule Fude.MixProject do
use Mix.Project
@version "0.2.0"
@source_url "https://github.com/hattoriai/fude"
# FUDE_OLDEST=1 resolves the oldest Phoenix and LiveView that Fude
# supports, for the CI job that tests them.
@oldest System.get_env("FUDE_OLDEST") in ["1", "true"]
def project do
[
app: :fude,
version: @version,
elixir: "~> 1.18",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
# For the code reloader of the development server (dev.exs). The
# listener is Phoenix 1.8's, so the oldest versions go without it.
listeners: if(@oldest, do: [], else: [Phoenix.CodeReloader]),
dialyzer: [
plt_add_apps: [:mix, :ex_unit, :esbuild, :ecto],
plt_core_path: "priv/plts",
plt_file: {:no_warn, "priv/plts/project.plt"},
ignore_warnings: ".dialyzer_ignore.exs"
],
package: package(),
docs: docs(),
description: description(),
name: "Fude",
source_url: @source_url,
homepage_url: @source_url
]
end
def application do
[extra_applications: [:logger]]
end
def cli do
[preferred_envs: [precommit: :test]]
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp deps do
[
{:bandit, "~> 1.5", only: :dev},
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.4", only: [:dev], runtime: false},
# Charts of an Ecto query, aggregated in the database (Fude.Query):
# optional. SQLite for its tests.
{:ecto, "~> 3.13", optional: true},
{:ecto_sql, "~> 3.13", only: :test},
{:ecto_sqlite3, "~> 0.22", only: :test},
# PostgreSQL and MySQL for the tests too, with FUDE_DB.
{:postgrex, "~> 0.20", only: :test},
{:myxql, "~> 0.8", only: :test},
{:esbuild, "~> 0.10", only: :dev, runtime: false},
{:ex_doc, "~> 0.34", only: :dev, runtime: false},
# Live charts with others (Fude.Issho): Issho 0.4's shared state.
{:issho, "~> 0.4", optional: true},
{:lazy_html, "~> 0.1", only: :test},
{:phoenix, if(@oldest, do: "~> 1.7.14", else: "~> 1.7.14 or ~> 1.8")},
{:phoenix_html, "~> 4.1"},
{:phoenix_live_reload, "~> 1.6", only: :dev},
{:phoenix_live_view, if(@oldest, do: "~> 1.1.0", else: "~> 1.1")},
{:stream_data, "~> 1.1", only: :test}
]
end
defp description do
"Charts for Phoenix: charts for LiveView drawn from your data, that update live, with a spec you can save, keyboard and screen reader support and Sumi's looks."
end
defp package do
[
name: "fude",
licenses: ["MIT"],
links: %{"GitHub" => @source_url},
# The bundle files by name: other build output in priv/static never
# goes into the package.
files: ~w(
lib
priv/static/fude.esm.js
priv/static/fude.cjs.js
priv/static/fude.css
priv/static/fude-sumi.css
priv/static/maps/world.json
priv/static/maps/us-states.json
package.json
mix.exs
.formatter.exs
guides
README.md
CHANGELOG.md
LICENSE
NOTICE
)
]
end
defp docs do
[
main: "readme",
source_ref: "v#{@version}",
source_url: @source_url,
# The banner of the README, at the same relative path in the docs.
assets: %{"media" => "media"},
extras: [
"README.md",
"guides/quickstart.md",
"guides/charts.md",
"guides/data.md",
"guides/story.md",
"guides/maps.md",
"guides/specs.md",
"guides/live.md",
"guides/collaboration.md",
"guides/testing.md",
"guides/theming.md",
"guides/accessibility.md",
"guides/limits.md",
"CHANGELOG.md"
],
groups_for_extras: [
Guides: ~r{guides/(quickstart|charts|data|story|maps|specs|live|collaboration)\.md},
"More guides": ~r{guides/(testing|theming|accessibility|limits)\.md}
],
groups_for_modules: [
Charts: [Fude, Fude.Chart, Fude.Layer, Fude.Channel, Fude.Annotation, Fude.Components],
Data: [Fude.Data, Fude.Query],
Live: [Fude.Live],
Collaboration: [Fude.Issho, Fude.Issho.Place],
Specs: [Fude.Spec],
Testing: [Fude.Test]
]
]
end
# The browser tests need their npm packages; `npm ci` runs once.
defp e2e_deps(_args) do
unless File.dir?("e2e/node_modules") do
Mix.Task.run("cmd", ~w(--cd e2e npm ci))
end
end
defp aliases do
[
"assets.build": ["fude.build"],
dev: "run --no-halt dev.exs",
"test.e2e": [&e2e_deps/1, "cmd --cd e2e npm test"],
"test.js": ["cmd --cd assets npm test"],
# The compile and the asset build run in a child VM, as in Kotoba:
# once anything compiles in this VM, Mix no longer finds the tasks of
# the Hex archive. The check refuses a priv/static with anything but
# the bundle files.
release: [
"cmd mix fude.build",
"cmd mix fude.release_check",
"hex.publish --yes",
"cmd git tag v#{@version} -f",
"cmd git push",
"cmd git push --tags"
],
precommit: [
"compile --warnings-as-errors",
"deps.unlock --unused",
"format",
"credo --strict",
"test"
]
]
end
end