mix.exs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. defmodule Plausible.MixProject do
  2. use Mix.Project
  3. def project do
  4. [
  5. name: "Plausible",
  6. source_url: "https://github.com/plausible/analytics",
  7. docs: docs(),
  8. app: :plausible,
  9. version: System.get_env("APP_VERSION", "0.0.1"),
  10. elixir: "~> 1.14",
  11. elixirc_paths: elixirc_paths(Mix.env()),
  12. start_permanent: Mix.env() in [:prod, :small],
  13. aliases: aliases(),
  14. deps: deps(),
  15. test_coverage: [
  16. tool: ExCoveralls
  17. ],
  18. releases: [
  19. plausible: [
  20. include_executables_for: [:unix],
  21. applications: [plausible: :permanent],
  22. steps: [:assemble, :tar]
  23. ]
  24. ],
  25. dialyzer: [
  26. plt_file: {:no_warn, "priv/plts/dialyzer.plt"},
  27. plt_add_apps: [:mix, :ex_unit]
  28. ]
  29. ]
  30. end
  31. # Configuration for the OTP application.
  32. #
  33. # Type `mix help compile.app` for more information.
  34. def application do
  35. [
  36. mod: {Plausible.Application, []},
  37. extra_applications: [
  38. :logger,
  39. :runtime_tools,
  40. :tls_certificate_check,
  41. :opentelemetry_exporter
  42. ]
  43. ]
  44. end
  45. # Specifies which paths to compile per environment.
  46. defp elixirc_paths(env) when env in [:test, :dev],
  47. do: ["lib", "test/support", "extra/lib"]
  48. defp elixirc_paths(env) when env in [:small_test, :small_dev],
  49. do: ["lib", "test/support"]
  50. defp elixirc_paths(:small), do: ["lib"]
  51. defp elixirc_paths(_), do: ["lib", "extra/lib"]
  52. # Specifies your project dependencies.
  53. #
  54. # Type `mix help deps` for examples and options.
  55. defp deps do
  56. [
  57. {:bamboo, "~> 2.3", override: true},
  58. {:bamboo_phoenix, "~> 1.0.0"},
  59. {:bamboo_postmark, git: "https://github.com/plausible/bamboo_postmark.git", branch: "main"},
  60. {:bamboo_smtp, "~> 4.1"},
  61. {:bcrypt_elixir, "~> 3.0"},
  62. {:bypass, "~> 2.1", only: [:dev, :test, :small_test]},
  63. {:cachex, "~> 3.4"},
  64. {:ecto_ch, "~> 0.3"},
  65. {:cloak, "~> 1.1"},
  66. {:cloak_ecto, "~> 1.2"},
  67. {:combination, "~> 0.0.3"},
  68. {:cors_plug, "~> 3.0"},
  69. {:credo, "~> 1.5", only: [:dev, :test], runtime: false},
  70. {:csv, "~> 2.3"},
  71. {:dialyxir, "~> 1.0", only: [:dev, :test], runtime: false},
  72. {:double, "~> 0.8.0", only: [:test, :small_test]},
  73. {:ecto, "~> 3.11.0"},
  74. {:ecto_sql, "~> 3.11.0"},
  75. {:envy, "~> 1.1.1"},
  76. {:eqrcode, "~> 0.1.10"},
  77. {:ex_machina, "~> 2.3", only: [:dev, :test, :small_dev, :small_test]},
  78. {:excoveralls, "~> 0.10", only: :test},
  79. {:finch, "~> 0.16.0"},
  80. {:floki, "~> 0.35.0", only: [:dev, :test, :small_dev, :small_test]},
  81. {:fun_with_flags, "~> 1.11.0"},
  82. {:fun_with_flags_ui, "~> 1.0"},
  83. {:locus, "~> 2.3"},
  84. {:gen_cycle, "~> 1.0.4"},
  85. {:hackney, "~> 1.8"},
  86. {:jason, "~> 1.3"},
  87. {:kaffy, "~> 0.10.2", only: [:dev, :test, :staging, :prod]},
  88. {:location, git: "https://github.com/plausible/location.git"},
  89. {:mox, "~> 1.0", only: [:test, :small_test]},
  90. {:nanoid, "~> 2.1.0"},
  91. {:nimble_totp, "~> 1.0"},
  92. {:oban, "~> 2.17.0"},
  93. {:observer_cli, "~> 1.7"},
  94. {:opentelemetry, "~> 1.1"},
  95. {:opentelemetry_api, "~> 1.1"},
  96. {:opentelemetry_ecto, "~> 1.1.0"},
  97. {:opentelemetry_exporter, "~> 1.6.0"},
  98. {:opentelemetry_phoenix, "~> 1.0"},
  99. {:opentelemetry_oban, "~> 1.0.0"},
  100. {:phoenix, "~> 1.7.0"},
  101. {:phoenix_view, "~> 2.0"},
  102. {:phoenix_ecto, "~> 4.0"},
  103. {:phoenix_html, "~> 3.3", override: true},
  104. {:phoenix_live_reload, "~> 1.2", only: [:dev, :small_dev]},
  105. {:phoenix_pubsub, "~> 2.0"},
  106. {:phoenix_live_view, "~> 0.18"},
  107. {:php_serializer, "~> 2.0"},
  108. {:plug, "~> 1.13", override: true},
  109. {:plug_cowboy, "~> 2.3"},
  110. {:postgrex, "~> 0.17.0"},
  111. {:prom_ex, "~> 1.8"},
  112. {:public_suffix, git: "https://github.com/axelson/publicsuffix-elixir"},
  113. {:ref_inspector, "~> 2.0"},
  114. {:referrer_blocklist, git: "https://github.com/plausible/referrer-blocklist.git"},
  115. {:sentry, "~> 8.0"},
  116. {:siphash, "~> 3.2"},
  117. {:timex, "~> 3.7"},
  118. {:ua_inspector, "~> 3.0"},
  119. {:ex_doc, "~> 0.28", only: :dev, runtime: false},
  120. {:ex_money, "~> 5.12"},
  121. {:mjml_eex, "~> 0.9.0"},
  122. {:mjml, "~> 1.5.0"},
  123. {:heroicons, "~> 0.5.0"},
  124. {:zxcvbn, git: "https://github.com/techgaun/zxcvbn-elixir.git"},
  125. {:open_api_spex, "~> 3.18"},
  126. {:joken, "~> 2.5"},
  127. {:paginator, git: "https://github.com/duffelhq/paginator.git"},
  128. {:scrivener_ecto, "~> 2.0"},
  129. {:esbuild, "~> 0.7", runtime: Mix.env() in [:dev, :small_dev]},
  130. {:tailwind, "~> 0.2.0", runtime: Mix.env() in [:dev, :small_dev]},
  131. {:ex_json_logger, "~> 1.4.0"},
  132. {:ecto_network, "~> 1.5.0"}
  133. ]
  134. end
  135. defp aliases do
  136. [
  137. setup: ["deps.get", "ecto.setup", "assets.setup", "assets.build"],
  138. "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
  139. "ecto.reset": ["ecto.drop", "ecto.setup"],
  140. test: ["ecto.create --quiet", "ecto.migrate", "test", "clean_clickhouse"],
  141. sentry_recompile: ["compile", "deps.compile sentry --force"],
  142. "assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"],
  143. "assets.build": [
  144. "tailwind default",
  145. "esbuild default"
  146. ],
  147. "assets.deploy": ["tailwind default --minify", "esbuild default --minify", "phx.digest"]
  148. ]
  149. end
  150. defp docs do
  151. [
  152. main: "readme",
  153. logo: "priv/static/images/ee/favicon-32x32.png",
  154. extras:
  155. Path.wildcard("guides/**/*.md") ++
  156. [
  157. "README.md": [filename: "readme", title: "Introduction"],
  158. "CONTRIBUTING.md": [filename: "contributing", title: "Contributing"]
  159. ],
  160. groups_for_extras: [
  161. Features: Path.wildcard("guides/features/*.md")
  162. ],
  163. before_closing_body_tag: fn
  164. :html ->
  165. """
  166. <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
  167. <script>mermaid.initialize({startOnLoad: true})</script>
  168. """
  169. _ ->
  170. ""
  171. end
  172. ]
  173. end
  174. end