-
Notifications
You must be signed in to change notification settings - Fork 12
/
mix.exs
104 lines (97 loc) · 2.78 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
defmodule MDEx.MixProject do
use Mix.Project
@source_url "https://github.com/leandrocp/mdex"
@version "0.3.0-dev"
@dev? String.ends_with?(@version, "-dev")
@force_build? System.get_env("MDEX_BUILD") in ["1", "true"]
def project do
[
app: :mdex,
version: @version,
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
package: package(),
docs: docs(),
deps: deps(),
aliases: aliases(),
name: "MDEx",
homepage_url: "https://github.com/leandrocp/mdex",
description: "A CommonMark-compliant fast and extensible Markdown parser and formatter."
]
end
def application do
[
extra_applications: [:logger]
]
end
defp package do
[
maintainers: ["Leandro Pereira"],
licenses: ["MIT"],
links: %{
Changelog: "https://hexdocs.pm/mdex/changelog.html",
GitHub: @source_url,
comrak: "https://crates.io/crates/comrak",
DockYard: "https://dockyard.com"
},
files: ~w[
lib/mdex.ex
lib/mdex
native/comrak_nif/src
native/comrak_nif/vendor
native/comrak_nif/.cargo
native/comrak_nif/Cargo.*
native/comrak_nif/Cross.toml
examples
mix.exs
benchmark.exs
README.md
LICENSE.md
CHANGELOG.md
checksum-Elixir.MDEx.Native.exs
]
]
end
defp docs do
[
main: "MDEx",
logo: "assets/images/mdex_icon.png",
source_ref: "v#{@version}",
source_url: @source_url,
extras: ["CHANGELOG.md"],
skip_undefined_reference_warnings_on: ["CHANGELOG.md"],
before_closing_head_tag: fn type ->
if type == :html do
"""
<script>
if (location.hostname === "hexdocs.pm") {
var script = document.createElement("script");
script.src = "https://plausible.io/js/script.js";
script.setAttribute("defer", "defer")
script.setAttribute("data-domain", "mdexhexdocs")
document.head.appendChild(script);
}
</script>
"""
end
end
]
end
defp deps do
[
{:rustler, "~> 0.32", optional: not (@dev? or @force_build?)},
{:rustler_precompiled, "~> 0.7"},
{:ex_doc, "~> 0.34", only: :dev}
]
end
defp aliases do
[
"deps.vendorize": ["cmd cp -rv ../autumn/native/autumn native/comrak_nif/vendor"],
"gen.checksum": "rustler_precompiled.download MDEx.Native --all --print",
"gen.samples": "mdex.generate_samples",
"format.all": ["format", "rust.fmt"],
"rust.lint": ["cmd cargo clippy --manifest-path=native/comrak_nif/Cargo.toml -- -Dwarnings"],
"rust.fmt": ["cmd cargo fmt --manifest-path=native/comrak_nif/Cargo.toml --all"]
]
end
end