luckyframework / luckyframework/lucky
Add option for orverriding placement of files generated with CLI generators
Nobody has claimed this yet.
- Dominant language
- Crystal
- Stars
- 2.7k
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
Currently if you use lucky gen.model this will put the file in src/models/ however, some people prefer to structure their apps in a different manner.
I haven't confirmed this, but I'm told that Marten offers a CLI flag of --app or --module that will place the files in to alternate structures. I'm not sure what that looks like exactly, but when this came up in Discord, here's an example structure for a Lucky app
On the one hand, having an option like --module that would automatically structure the generated files like this would be nice, but on the other hand, if you're looking to structure your app differently and it's not like this or the default, then you're still left with not being able to use the CLI generators and hand moving all of your files around...
Lucky should always try to provide an escape hatch for when some design choice was made and someone wants a way around it. I think maybe just adding a --dir=./src/path/to/where you want might be good. Though, I'm not sure how using lucky gen.resource.browser would work since this creates files in like 6 different spots. Now we're talking about 6 new flags??
lucky gen.resource.browser Post title:String --model-dir=./src/modules/blog/ --migration-dir --operation-dir --query-dir --actions-dir --pages-dir
We had some discussion about this before https://github.com/luckyframework/lucky/discussions/642
So I guess this comes down to 3 options:
- Lucky doesn't support alternate structures, and if you want to use something different, then it's up to you to hand-roll for each project
- Lucky supports very specific structures that are A, B, or C, and that's it. If you don't like those options, you're still left with hand rolling. This option would also make testing app generation O(n) times more difficult ref
- Lucky adds CLI flag options for each file location allowing you to specify. This makes CLI use extremely difficult and verbose and prone to lots of mistakes as a typo could be missed
e.g. --mirations-dir.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the CLI generator implementation and the lucky_cli/fixtures referenced in the issue, then read discussion 642 for prior context. Before coding, define whether the project will support per-location flags, a fixed set of structures, or no alternate structure; the issue is done only when one approach is agreed and its generator behavior and tests are specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100