lucky_cli icon indicating copy to clipboard operation
lucky_cli copied to clipboard

Remove .keep files with other files in the directory during init process

Open matthewmcgarvey opened this issue 3 years ago • 5 comments

The most annoying thing that I find myself wasting time on when I create a new project is deleting these pesky .keep files from directories. They're all over and almost none of them are necessary in a normally generated project. It shouldn't be too hard to find all .keep files and delete any with other files in the directory. It could be one of the last steps in the init command and it would save me like 5 minutes of time 🙏

matthewmcgarvey avatar Sep 17 '22 02:09 matthewmcgarvey

Aren't they needed because default git setups won't include empty directories? So you end up losing context. Or is that not a thing anymore?

Related: https://github.com/luckyframework/lucky_cli/issues/741

jwoertink avatar Sep 17 '22 04:09 jwoertink

Yeah, I the idea is that you preserve the expected structure of a Lucky app using these .keep files, even if you remove all of the non-hidden files (like clearing our all actions).

I don't think we should do this by default, but like the idea of having it as an init flag like Rails does (I think it's --no-keep).

stephendolan avatar Sep 17 '22 11:09 stephendolan

Sorry, it was late and I didn't explain it well. I'm talking about .keep files that are in directories with other files or directories. Because of that, they are there for no reason. So what i'm recommending is leaving the .keep files that are there for a reason and remove the ones that aren't (which is the vast majority on a normal app).

matthewmcgarvey avatar Sep 17 '22 15:09 matthewmcgarvey

Is the reason for those that we might add a generator to the CLI that doesn't populate them, though?

stephendolan avatar Sep 17 '22 16:09 stephendolan

Yeah, I guess that makes sense. If we generate a .keep inside of the src/actions, that should go away since you'll never have an empty actions directory in Lucky. It almost seems like it's just mixins directories that would have it, right?

jwoertink avatar Sep 17 '22 19:09 jwoertink