two "mix ash_phoenix.gen.live" commands for the same resource create assets in two directories
- Dominant language
- Elixir
- Stars
- 2.5k
- Forks
- 422
- Avg merge
- 23h 26m
- Merged PRs (30d)
- 46
Description
**Describe the bug**
I ran two identical mix ash_phoenix.gen.live commands. They each created their a new directory for the show.ex, index.ex, and form_component.ex files. When I started the server, there were warning messages about redefinition of a module.
```
warning: redefining module DofAppWeb.AwardLive.Show (current version loaded from _build/dev/lib/dof_app/ebin/Elixir.DofAppWeb.AwardLive.Show.beam)
│
1 │ defmodule DofAppWeb.AwardLive.Show do
│ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│
└─ lib/dof_app_web/live/award_live/show.ex:1: DofAppWeb.AwardLive.Show (module)
```
**To Reproduce**
create a project with ash, phoenix, and LiveView. Create a domain and a resource run the mix ash_phoenix.gen.live ... twice. then find the `lib/.../*_live` directories. I saw two:
```
heb@Howards-MacBook-Pro dof_app % find lib/dof_app_web -name '*_live' -print
lib/dof_app_web/education_live
lib/dof_app_web/judge_live
lib/dof_app_web/award_live
lib/dof_app_web/live/award_live
heb@Howards-MacBook-Pro dof_app %
```
The second (`lib/dof_app_web/live/award_live`) directory was created when I ran the command the second time.
**Expected behavior**
I would like the same directory to be used for each execution of `mix ash_phoenix.gen.live`. I would like to use git for version control of the `*.ex` files.
**Runtime**
```
heb@Howards-MacBook-Pro dof_app % elixir -v
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Elixir 1.18.1 (compiled with Erlang/OTP 27)
heb@Howards-MacBook-Pro dof_app % - MacBook Pro, OS 15.3.2 (24D81)
```
- Ash version: `"ash": {:hex, :ash, "3.4.71"`
- any related extension versions: `"ash_phoenix": {:hex, :ash_phoenix, "2.1.23",`
**Additional context**
This is for a (the?) science fair domain.`dof` means day of fair. I apologize because I started programming using a model 33 teletype, with symbols limited to 6 characters.
Contributor guide
Research direction
Reproduce the issue with two identical `mix ash_phoenix.gen.live` commands and inspect the generated `lib/.../*_live` directories, especially the duplicate `lib/dof_app_web/award_live` and `lib/dof_app_web/live/award_live` paths. Done means repeated generation uses one directory and does not produce duplicate module redefinition warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100