Skip to content

Compare files generated using various Elixir project generators

License

Notifications You must be signed in to change notification settings

aj-foster/elixir-diff

Repository files navigation

Elixir Diff

View the differences between files created by various Elixir project generators. https://elixirdiff.com/

What is this?

Occasionally, I find myself wondering about the difference between various Elixir project generators. Maybe I forgot to add the --sup flag while running mix new. Or maybe it's time to add Phoenix to a project that wasn't generated with mix phx.new. Without generating a new project and manually looking at files, how can you tell what needs to change?

This project — heavily inspired by PhoenixDiff — shows the differences.

It was a quick weekend project. Nothing world-changing here.

Examples

If you're interested in changes to generators across versions of Phoenix, I highly recommend you use PhoenixDiff.

How does it work?

By generating a bunch of projects with every combination of available flags, we can ask git to compare files and generate a patch file. Then we can present those patch files in a friendly web interface.

Notably, the number of pairwise diffs grows very rapidly when we add new generators and variants. As a result, a few of the decisions about how the front-end works were driven by a need to avoid listing out all of the variant combinations.

If you're bored, try calculating out how many diffs there are for (2 + 7 + 1) generator flags across the three projects. Then checkout the Handshake Lemma and begin down the fun rabbit hole that is Graph Theory.

What's up with your technology choices?

Maybe it was a longing for simplicity, or maybe it was nostalgia. This just seemed like a project that could be accomplish with plain old HTML/CSS/JS along with some Bash scripts. There's one line of Elixir code, evaled in a script to get the current version. Other than that, jumping through the hoops of using vanilla JS and Bash were entertaining.

One bonus of this setup is that GitHub will build and host the site for free, thanks to GitHub Actions and Pages.

My use of CanIUse was sparse, and some of the more modern JavaScript features used may not work in all browsers. Please let me know if there's anything in particular that could be polyfilled or regressed. The lack of a front-end build step for the site is probably okay for now.

Contributing

Contributions are welcome. Please open issues with ideas for improvement. If the community takes any interest in this project, we can add a more comprehensive contribution policy.

License

The code provided in this repository is presented under the MIT license. Chances are, though, you won't want to use it for anything. It's just a quick weekend project.

About

Compare files generated using various Elixir project generators

Resources

License

Stars

Watchers

Forks