Move Mix project to the root dir

This commit moves the mix.exs, mix.lock and priv directors that were
inside app/ to the root directory. Configuration tweaks with paths were
done for the asset building.

The priv/ directory had to be moved because mix by default symlinks it
inside the build output, and I couldn't find a configuration option to
have it live inside app/
This commit is contained in:
Nikos Papadakis 2023-11-04 15:50:35 +02:00
parent 0ce0132554
commit 59c8c6ee23
Signed by untrusted user who does not match committer: nikos
GPG key ID: 78871F9905ADFF02
17 changed files with 14 additions and 21 deletions

4
.gitignore vendored
View file

@ -2,3 +2,7 @@
/.db/
/.vagrant/
/.direnv/
/deps/
/_build/
/priv/static/assets/
/priv/static/cache_manifest.json

12
app/.gitignore vendored
View file

@ -1,12 +1,6 @@
# The directory Mix will write compiled artifacts to.
/_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/
# The directory Mix downloads your dependencies sources to.
/deps/
# Where 3rd-party dependencies like ExDoc output generated docs.
/doc/
@ -25,12 +19,6 @@ erl_crash.dump
# Ignore package tarball (built via "mix hex.build").
prymn-*.tar
# Ignore assets that are produced by build tools.
/priv/static/assets/
# Ignore digested assets cache.
/priv/static/cache_manifest.json
# In case you use Node.js/npm, you want to ignore these.
npm-debug.log
/assets/node_modules/

View file

@ -34,9 +34,9 @@ config :esbuild,
version: "0.17.11",
default: [
args:
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
~w(js/app.js --bundle --target=es2017 --outdir=../../priv/static/assets --external:/fonts/* --external:/images/*),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
env: %{"NODE_PATH" => Path.expand("../../deps", __DIR__)}
]
# Configure tailwind (the version is required)
@ -46,7 +46,7 @@ config :tailwind,
args: ~w(
--config=tailwind.config.js
--input=css/app.css
--output=../priv/static/assets/app.css
--output=../../priv/static/assets/app.css
),
cd: Path.expand("../assets", __DIR__)
]

View file

@ -8,6 +8,7 @@ defmodule Prymn.MixProject do
elixir: "~> 1.15",
compilers: [:proto | Mix.compilers()],
elixirc_paths: elixirc_paths(Mix.env()),
config_path: Path.expand("app/config/config.exs", __DIR__),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
@ -25,8 +26,8 @@ defmodule Prymn.MixProject do
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp elixirc_paths(:test), do: ["app/lib", "app/test/support"]
defp elixirc_paths(_), do: ["app/lib"]
# Specifies your project dependencies.
#
@ -62,7 +63,7 @@ defmodule Prymn.MixProject do
{:tailwind_formatter, "~> 0.3.6", runtime: Mix.env() == :dev},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:dialyxir, "~> 1.4", only: [:dev], runtime: false},
{:prymn_proto_compiler, path: "../proto_compiler", runtime: false}
{:prymn_proto_compiler, path: "proto_compiler", runtime: false}
]
end

View file

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -5,8 +5,8 @@ defmodule Mix.Tasks.Compile.Proto do
@impl true
def run(_args) do
output = "./lib/prymn_proto"
sources = Path.wildcard("../proto/*.proto")
output = "./app/lib/prymn_proto"
sources = Path.wildcard("proto/*.proto")
targets = Path.wildcard(output <> "/*.pb.ex")
if Mix.Utils.stale?(sources, targets) do
@ -27,7 +27,7 @@ defmodule Mix.Tasks.Compile.Proto do
"--elixir_out=plugins=grpc:" <> output,
"--elixir_opt=package_prefix=prymn_proto",
"-I",
"../proto"
"proto"
] ++ sources
)
end