-
Notifications
You must be signed in to change notification settings - Fork 6
/
mix.exs
129 lines (118 loc) · 3.97 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# credo:disable-for-this-file Credo.Check.Readability.Specs
defmodule Hologram.MixProject do
use Mix.Project
defp aliases do
[
eslint:
"cmd assets/node_modules/.bin/eslint --color --config assets/eslint.config.mjs assets/js/** test/javascript/**",
f: ["format", "prettier", "cmd cd test/features && mix format"],
prettier:
"cmd assets/node_modules/.bin/prettier '*.yml' '.github/**' 'assets/*.json' 'assets/*.mjs' 'assets/js/**' 'test/javascript/**' --config 'assets/.prettierrc.json' --write",
t: ["test", "test.js"],
"test.js": [&test_js/1]
]
end
def application do
if dep?() do
[
mod: {Hologram.Application, []},
extra_applications: [:logger]
]
else
[
extra_applications: [:logger]
]
end
end
def dep? do
__MODULE__.module_info()[:compile][:source]
|> to_string()
|> String.ends_with?("/deps/hologram/mix.exs")
end
defp deps do
[
{:beam_file, "0.6.2"},
{:benchee, "~> 1.0", only: :dev, runtime: false},
{:benchee_markdown, "~> 0.3", only: :dev, runtime: false},
{:credo, "~> 1.0", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
{:doctor, "~> 0.21", only: [:dev, :test], runtime: false},
{:ecto, "~> 3.0", only: :test, runtime: false},
{:ex_check, "~> 0.15", only: [:dev, :test], runtime: false},
# file_system test env is required by credo
{:file_system, "~> 1.0", only: [:dev, :test]},
{:html_entities, "~> 0.5"},
{:interceptor, "~> 0.5"},
# It seems that libgraph is not maintained - there are pending pull requests and not released commits.
{:libgraph,
git: "https://github.com/bitwalker/libgraph",
ref: "460cdfd9a163a533bdab0a160ba7ccf888047927"},
{:mix_audit, "~> 2.0", only: [:dev, :test], runtime: false},
{:mox, "~> 1.0", only: :test},
{:phoenix, "~> 1.7"},
{:recode, "~> 0.7", only: :dev, runtime: false},
{:sobelow, "~> 0.12", only: [:dev, :test], runtime: false}
]
end
defp elixirc_paths(:dev), do: ["benchmarks/support", "lib"]
defp elixirc_paths(:test), do: ["lib", "test/elixir/fixtures", "test/elixir/support"]
defp elixirc_paths(_env), do: ["lib"]
def package do
[
files: ["lib", "mix.exs", "README.md"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/bartblast/hologram"},
maintainers: ["Bart Blast"]
]
end
defp preferred_cli_env do
[
t: :test,
"test.js": :test
]
end
def project do
[
aliases: aliases(),
app: :hologram,
deps: deps(),
description:
"Full stack isomorphic Elixir web framework that can be used on top of Phoenix.",
dialyzer: [
plt_add_apps: [:ex_unit, :iex, :mix],
plt_core_path: Path.join(["priv", "plts", "core.plt"]),
plt_local_path: Path.join(["priv", "plts", "project.plt"])
],
elixir: "~> 1.0",
elixirc_options: [warnings_as_errors: true],
elixirc_paths: elixirc_paths(Mix.env()),
package: package(),
preferred_cli_env: preferred_cli_env(),
start_permanent: Mix.env() == :prod,
test_paths: ["test/elixir"],
version: "0.1.0",
xref: [
# These modules are used only in tests to test whether Hex.Solver's implementations
# for Inspect and String.Chars protocols are excluded when building runtime and pages JavaScript files.
exclude: [
Inspect.Hex.Solver.PackageRange,
String.Chars.Hex.Solver.PackageRange
]
]
]
end
defp test_js(args) do
cmd =
if Enum.empty?(args) do
["test"]
else
["run", "test-file", "../#{hd(args)}"]
end
opts = [cd: "assets", into: IO.stream(:stdio, :line)]
System.cmd("npm", ["install"], opts)
{_exit_msg, exit_status} = System.cmd("npm", cmd, opts)
if exit_status > 0 do
Mix.raise("JavaScript tests failed!")
end
end
end