-
-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document practices around keeping empty directories in source control #836
Comments
Empty directories are a bit problematic because they won't be commited to git. We've taken a similar approach with Yeoman internal file system to only track files. My suggestion would be to add a file to keep the directories in source control - with git, we usually see empty I don't think we're planning to change this core behavior of Yeoman in the near future. |
According to yeoman/yeoman#1668 the Right Way™ to do this is to create an empty .gitkeep file, particularly because git doesn't track empty directories.
According to yeoman/yeoman#1668 the Right Way™ to do this is to create an empty .gitkeep file, particularly because git doesn't track empty directories.
Gotcha. That makes a lot of sense. It'd be nice if this was documented somewhere. |
🤔 I'm not convinced this needs a full mention in docs. Creating empty directories is pretty rare. Most tools these days handle them well. The first use cases that come to mind for me are directories like Sorry for pinging so many years later @strugee, just checking - is there a particular reason why you'd want empty directories? |
@JoshuaKGoldberg it's been many, many years since I touched Yeoman code, but at the time I was writing a Yeoman generator for my static site generator project. It was probably to create the standard location for images: Looking back another way to solve this would be for Yeoman to just automatically create a |
👍 Makes sense, thanks! Having a blank directory like As to where to put this, I'm not sure 🤔. I don't think it needs to be a high-level point in the main docs - it's not something you need to understand to learn the foundations of generators. Maybe an FAQ in https://yeoman.io/learning/faq? |
Currently the Right Way™ to modify the filesystem in a generator is to use mem-fs-editor, and the Right Way™ to create a directory with mem-fs-editor is to directly use mkdirp. That works fine; however, the empty directory doesn't display in the list of files created (or conflicted, or whatever) at the end of the generator run. It'd be nice if I could tell Yeoman about these directories so it would display them in the list of created files.
The text was updated successfully, but these errors were encountered: