Skip to content

Commit

Permalink
Improve mix.exs, docs and hex page
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoefmoraes committed Sep 14, 2024
1 parent 067d028 commit 29660e7
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,51 @@ defmodule Surface.Catalogue.MixProject do
use Mix.Project

@version "0.6.2"
@source_url "https://github.com/surface-ui/surface_catalogue"
@homepage_url "https://surface-ui.org"

def project do
[
app: :surface_catalogue,
version: @version,
elixir: "~> 1.13",
description: "An initial prototype of the Surface Catalogue",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers() ++ [:surface],
start_permanent: Mix.env() == :prod,
deps: deps(),
docs: docs(),
aliases: aliases(),
xref: [exclude: Surface.Catalogue.Playground],
deps: deps(),
preferred_cli_env: [docs: :docs],
# Docs
name: "Surface Catalogue",
source_url: @source_url,
homepage_url: @homepage_url,
docs: docs(),
package: package()
]
|> Blend.Premix.patch_project()
end

# Run "mix help compile.app" to learn about applications.
def application do
[
mod: {Surface.Catalogue.Application, []},
extra_applications: [:logger]
]
end

defp elixirc_paths(:dev), do: ["lib"] ++ catalogues()
defp elixirc_paths(:test), do: ["lib", "test/support"] ++ catalogues()
defp elixirc_paths(_), do: ["lib"]

def catalogues do
["priv/catalogue"] ++ surface_catalogue_path()
end

defp surface_catalogue_path() do
Enum.find(deps(), &(elem(&1, 0) == :surface))
deps()
|> List.keyfind!(:surface, 0)
|> surface_dep_opts()
|> surface_catalogue_path()
end
Expand All @@ -52,8 +65,8 @@ defmodule Surface.Catalogue.MixProject do
defp surface_catalogue_path(opts) do
path =
case opts[:path] do
nil -> "deps/surface"
surface_dep_path -> Path.expand(surface_dep_path)
nil -> Mix.Project.deps_path() |> Path.relative() |> Path.join("/surface")
surface_dep_path -> Path.expand(surface_dep_path) |> IO.inspect(label: :expand)
end

["#{path}/priv/catalogue"]
Expand All @@ -64,16 +77,13 @@ defmodule Surface.Catalogue.MixProject do
defp surface_dep_opts({:surface, _req}), do: []
defp surface_dep_opts(_), do: nil

defp elixirc_paths(:dev), do: ["lib"] ++ catalogues()
defp elixirc_paths(:test), do: ["lib", "test/support"] ++ catalogues()
defp elixirc_paths(_), do: ["lib"]

defp aliases do
[
dev: "run --no-halt dev.exs"
]
end

# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:surface, "~> 0.10"},
Expand All @@ -95,7 +105,6 @@ defmodule Surface.Catalogue.MixProject do
[
main: "readme",
source_ref: "v#{@version}",
source_url: "https://github.com/surface-ui/surface_catalogue",
nest_modules_by_prefix: [Surface.Catalogue],
extras: [
"README.md",
Expand All @@ -108,10 +117,20 @@ defmodule Surface.Catalogue.MixProject do
defp package do
%{
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/surface-ui/surface_catalogue"},
files:
~w(assets lib priv/catalogue) ++
~w(CHANGELOG.md LICENSE.md mix.exs README.md)
links: %{
Website: @homepage_url,
Changelog: "https://hexdocs.pm/surface_catalogue/changelog.html",
GitHub: @source_url
},
files: ~w(
README.md
CHANGELOG.md
LICENSE.md
mix.exs
lib
assets
priv/catalogue
)
}
end
end

0 comments on commit 29660e7

Please sign in to comment.