I'm going through the Programming Elixir
book and currently got to the point of creating a little console using mix escript.build
(similar to this documentation example: https://hexdocs.pm/mix/Mix.Tasks.Escript.Build.html#module-example)
Now, it produces an executable myprojname
in the project folder, which is cool and good.
BUT I really don't want to track executables in source control.
Coming from .NET, I'm used to .gitignore
just ignoring anything under the /bin
path, but the binary Elixir generates is:
What's the best practice for .gitignore
-ing escript files in Elixir project?
So far I've added this line to .gitignore
and it works:
myprojname
But is there a better way that I'm missing? (In .NET, pretty much all projects have the same .gitignore file, because anything to be ignored is usually under a pre-defined path such as /bin
, /obj
etc. or has an extension like .solutionuseroptions
.
You should have it explicitly listed in your .gitignore
. That's how Livebook does, for example.
One alternative way is using the --path
option, where you can set a custom name or folder to compile the project. Make sure to ignore this path in .gitignore
.
mix escript.build --path executable.ignoredextension
mix escript.build --path ./ignored_folder/executable