Packages

gamend_web

1.1.1521
1.1.1573 1.1.1572 1.1.1571 1.1.1570 1.1.1569 1.1.1552 1.1.1550 1.1.1545 1.1.1542 1.1.1537 1.1.1536 1.1.1535 1.1.1534 1.1.1533 1.1.1532 1.1.1531 1.1.1530 1.1.1529 1.1.1528 1.1.1527 1.1.1526 1.1.1525 1.1.1524 1.1.1523 1.1.1522 1.1.1521 1.1.1520 1.1.1519 1.1.1516 1.1.1514 1.1.1513 1.1.1512 1.1.1511 1.1.1510 1.1.1509 1.1.1505 1.1.1504 1.1.1502 1.1.1501 1.1.1496 1.1.1495 1.1.1494 1.1.1493 1.1.1491 1.1.1490 1.1.1487 1.1.1485 1.1.1484 1.1.1483 1.1.1482 1.1.1481 1.1.1479 1.1.1478 1.1.1477 1.1.1476 1.1.1475 1.1.1474 1.1.1472 1.1.1471 1.1.1470 1.1.1469 1.1.1467 1.1.1465 1.1.1463 1.1.1462 1.1.1460 1.1.1458 1.1.1457 1.1.1455 1.1.1453 1.1.1451 1.1.1450 1.1.1449 1.1.1446 1.1.1445 1.1.1444 1.1.1442 1.1.1441 1.1.1440 1.1.1439 1.1.1438 1.1.1437 1.1.1436 1.1.1435 1.1.1431 1.1.1430 1.1.1429 1.1.1425 1.1.1424 1.1.1418 1.1.1417 1.1.1416 1.1.1415 1.1.1414 1.1.1413 1.1.1412 1.1.1410 1.1.1409 1.1.1408 1.1.1407 1.1.1406 1.1.1405 1.1.1404 1.1.1403 1.1.1402 1.1.1397 1.1.1396 1.1.1393 1.1.1392 1.1.1391 1.1.1390 1.1.1389 1.1.1388 1.1.1387 1.1.1380 1.1.1379 1.1.1378 1.1.1377 1.1.1376 1.1.1375 1.1.1374 1.1.1373 1.1.1372 1.1.1371 1.1.1370 1.1.1369 1.1.1368 1.1.1367 1.1.1366 1.1.1365 1.1.1364 1.1.1363 1.1.1362 1.1.1361 1.1.1360 1.1.1359 1.1.1358 1.1.1357 1.1.1356 1.1.1352 1.1.1351 1.1.1348 1.1.1347 1.1.1346 1.1.1345 1.1.1344 1.1.1343 1.1.1342 1.1.1341 1.1.1340 1.1.1339 1.1.1338 1.1.1337 1.1.1336 1.1.1335 1.1.1334 1.1.1333 1.1.1332 1.1.1331 1.1.1330 1.1.1328 1.1.1327 1.1.1325 1.1.1324 1.1.1323 1.1.1322 1.1.1321 1.1.1320 1.1.1319 1.1.1318 1.1.1317 1.1.1316 1.1.1315 1.1.1314 1.1.1313 1.1.1312 1.1.1311 1.1.1310 1.1.1309 1.1.1308 1.1.1307 1.1.1304 1.1.1302 1.0.1301 1.0.1300 1.0.1299 1.0.1298 1.0.1297 1.0.1296 1.0.1295 1.0.1294 1.0.1290 1.0.1289 1.0.1288 1.0.1287 1.0.1286 1.0.1285 1.0.1283 1.0.1281 1.0.1280 1.0.1279 1.0.1278 1.0.1277 1.0.1276 1.0.1275 1.0.1274 1.0.1273 1.0.1270 1.0.1269 1.0.1267 1.0.1266 1.0.1265 1.0.1263 1.0.1262 1.0.1261 1.0.1260 1.0.1259 1.0.1258 1.0.1257 1.0.1256 1.0.1255 1.0.1254 1.0.1251 1.0.1250 1.0.1249 1.0.1247 1.0.1245 1.0.1240 1.0.1239 1.0.1238 1.0.1236 1.0.1235 1.0.1233 1.0.1230 1.0.1229 1.0.1228 1.0.1227 1.0.1226 1.0.1225 1.0.1224 1.0.1223 1.0.1222 1.0.1221 1.0.1220 1.0.1219 1.0.1217 1.0.1216 1.0.1215

Web interface for Gamend, built with Phoenix Framework. Provides APIs, authentication, real-time features, and payments.

Current section

Files

Jump to
gamend_web mix.exs
Raw

mix.exs

defmodule GamendWeb.MixProject do
  use Mix.Project

  @version "1.1.1521"
  @source_url "https://github.com/appsinacup/gamend"

  def project do
    [
      app: :gamend_web,
      version: @version,
      elixir: "~> 1.20",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      listeners: [Phoenix.CodeReloader],
      dialyzer: [plt_add_apps: [:mix]],
      aliases: aliases(),
      deps: deps(),
      compilers: [:phoenix_live_view] ++ Mix.compilers(),
      description: description(),
      package: package(),
      docs: docs()
    ]
  end

  def application do
    [
      extra_applications: [:logger]
    ]
  end

  def cli do
    [
      preferred_envs: [precommit: :test]
    ]
  end

  # The core's test support (DataCase, fixtures, the test runtime) lives with
  # the core suite and is shared from there, not copied.
  defp elixirc_paths(:test),
    do: ["lib", "test/support", Path.expand("../gamend_core/test/support", __DIR__)]

  defp elixirc_paths(_), do: ["lib"]

  defp deps do
    [
      {:gamend_core, "~> 1.1"},
      {:phoenix, "~> 1.8.3"},
      {:protobuf, "~> 0.17"},
      {:phoenix_ecto, "~> 4.5"},
      {:phoenix_html, "~> 4.1"},
      {:phoenix_live_reload, "~> 1.7", only: :dev},
      {:phoenix_live_view, "~> 1.2.1"},
      {:lazy_html, ">= 0.1.0", only: :test},
      {:phoenix_live_dashboard, "~> 0.9"},
      {:oban_web, "~> 2.11"},
      {:esbuild, "~> 0.10", runtime: Mix.env() == :dev},
      {:tailwind, "~> 0.3", runtime: Mix.env() == :dev},
      # dev/test only, and deliberately so: heroicons is a GitHub-only dep, and
      # Hex reads requirements from the published environments alone — a
      # runtime entry here would make gamend_web unpublishable. The
      # host/consumer app still declares heroicons in its own mix.exs and runs
      # `assets.setup` to make the icon CSS available to the shared tailwind
      # plugin in apps/gamend_web/assets/vendor/heroicons. This copy is the one
      # `GamendWeb.Icons` embeds when the app is compiled on its own, with no
      # host deps directory to look in: its standalone test suite, and the docs
      # build inside `mix hex.publish`.
      {:heroicons,
       github: "tailwindlabs/heroicons",
       tag: "v2.2.0",
       sparse: "optimized",
       app: false,
       compile: false,
       depth: 1,
       only: [:dev, :test],
       runtime: false},
      {:swoosh, "~> 1.20"},
      {:gen_smtp, "~> 1.0"},
      {:req, "~> 0.6"},
      {:telemetry_metrics, "~> 1.0"},
      {:telemetry_poller, "~> 1.0"},
      {:gettext, "~> 1.0"},
      {:jason, "~> 1.2"},
      {:dns_cluster, "~> 0.3.0"},
      {:ueberauth_apple, "~> 0.7"},
      {:bandit, "~> 1.9"},
      {:ueberauth, "~> 0.10"},
      {:open_api_spex, "~> 3.22"},
      {:credo, ">= 1.7.16", only: [:dev, :test], runtime: false},
      {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false},
      {:ex_doc, "~> 0.40", only: :dev, runtime: false},
      {:guardian, "~> 2.3"},
      {:ueberauth_steam_strategy, "~> 0.2.2"},
      {:corsica, "~> 2.0"},
      {:hammer, "~> 7.2"},
      {:hammer_backend_redis, "~> 7.1"},
      {:ex_webrtc, "~> 0.18.0"},
      {:ex_sctp, "~> 0.1.3"},
      {:prom_ex, "~> 1.12"},
      {:geolix, "~> 2.0"},
      {:geolix_adapter_mmdb2, "~> 0.6"}
    ]
  end

  defp aliases do
    [
      setup: ["deps.get", "ecto.setup", "assets.setup", "assets.build"],
      "deps.get": &deps_get/1,
      "ecto.setup": [
        "ecto.create",
        "ecto.migrate",
        "run priv/repo/seeds.exs"
      ],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      test: [
        "ecto.create --quiet",
        "ecto.migrate --quiet",
        "compile --force",
        "test"
      ],
      "assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"],
      "assets.build": ["compile", "tailwind gamend_web", "esbuild gamend_web"],
      "assets.deploy": [
        "tailwind gamend_web --minify",
        "esbuild gamend_web --minify",
        "phx.digest"
      ],
      lint: ["format --check-formatted", "credo --strict"],
      # gamend_core is a path dep, so its modules sit in the *deps* PLT while
      # dialyxir keys its freshness on mix.lock alone — core source can change
      # without the hash moving. Skipping the recheck then reports every core
      # function added since the PLT was built as one that does not exist. CI
      # drops the hash file for the same reason.
      dialyzer: ["dialyzer --force-check"],
      precommit: [
        "compile --warnings-as-errors",
        "xref unreachable",
        "format",
        "gen.sdk",
        "test",
        "credo --strict"
      ]
    ]
  end

  # Raises :httpc's header limit in the deps that download GitHub release
  # assets with it. Why, and when to remove it: deps_get/1 in the repository's
  # root mix.exs. This app keeps its own deps/, so it needs its own.
  @httpc_downloads [
    rustler_precompiled: "lib/rustler_precompiled.ex",
    elixir_make: "lib/elixir_make/downloader/httpc.ex"
  ]

  defp deps_get(args) do
    Mix.Tasks.Deps.Get.run(args)

    unpatched = "options = [body_format: :binary]"
    patched = "options = [body_format: :binary, max_header_size: 65_536]"

    for {dep, path} <- @httpc_downloads,
        file = Path.join([Mix.Project.deps_path(), Atom.to_string(dep), path]),
        {:ok, source} <- [File.read(file)],
        not String.contains?(source, patched) do
      unless String.contains?(source, unpatched),
        do: Mix.raise("#{dep} changed: revisit deps_get/1 in mix.exs")

      File.write!(file, String.replace(source, unpatched, patched))

      Mix.Project.build_path()
      |> Path.dirname()
      |> Path.join("*/lib/#{dep}")
      |> Path.wildcard()
      |> Enum.each(&File.rm_rf!/1)
    end
  end

  defp description do
    """
    Web interface for Gamend, built with Phoenix Framework. Provides APIs, authentication, real-time features, and payments.
    """
  end

  defp package do
    [
      name: "gamend_web",
      licenses: ["MIT"],
      links: %{
        "GitHub" => @source_url,
        "Changelog" => "#{@source_url}/blob/main/CHANGELOG.md"
      },
      # A host builds its own CSS/JS bundle from these: its app.css imports
      # `assets/css/gamend.css` (through `mix gamend.assets`' pointers), which
      # scans `assets/js` and `lib` for classes and loads the shared plugins
      # in `assets/vendor` (heroicons, daisyUI, core's classes). `priv/static/flags` is
      # served straight out of this app by the endpoint's bundled-static plug,
      # alongside the fonts.
      files: ~w(lib assets/css assets/js assets/vendor assets/tsconfig.json priv/gettext
                priv/static/fonts priv/static/flags .formatter.exs mix.exs
                README.md LICENSE)
    ]
  end

  defp docs do
    [
      main: "readme",
      source_url: @source_url,
      source_ref: "v#{@version}",
      extras: ["README.md", "../../CHANGELOG.md"],
      # Two audiences share this package: a host app calls a handful of
      # modules, everything else is mounted by the route macros. One flat list
      # of 200+ modules hides that distinction entirely.
      groups_for_modules: module_groups()
    ]
  end

  defp module_groups do
    [
      "Host integration": [
        GamendWeb,
        GamendWeb.Router.Shared,
        GamendWeb.Endpoint,
        GamendWeb.UserAuth,
        GamendWeb.Layouts,
        GamendWeb.CoreComponents,
        GamendWeb.Telemetry,
        GamendWeb.Router
      ],
      "Plugs & mounts": [~r/^GamendWeb\.(Plugs|OnMount|Auth)/],
      "REST API": [~r/^GamendWeb\.(Api\.|Schemas\.|ApiSpec|.*Controller$|.*HTML$|.*JSON$)/],
      Channels: [~r/^GamendWeb\.(.*Channel|UserSocket|Presence|WebRTCPeer)/],
      Admin: [~r/^GamendWeb\.AdminLive/],
      "Player pages": [~r/^GamendWeb\.(\w*Live($|\.)|LiveHelpers|PresentationPage|PageHTML)/],
      Helpers: [
        ~r/^GamendWeb\.(Helpers|Serializers|Pagination|Components|Gettext|EventCodec|SRI)/
      ],
      # Observability and runtime plumbing a host runs but rarely calls.
      Runtime: [
        ~r/^GamendWeb\.(PromEx|Telemetry|RateLimit|ConnectionTracker|AdminLogBuffer|FileLogHandler|HostSupervision|RuntimeIntrospection|RealtimeEvents|GeoCountryCleaner|HostContentStatic|HostLayouts)/
      ]
    ]
  end
end