Skip to content
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

Add a .gitkeep file to add empty but required folders to git #66

Merged
merged 3 commits into from
May 28, 2016
Merged

Add a .gitkeep file to add empty but required folders to git #66

merged 3 commits into from
May 28, 2016

Conversation

THPubs
Copy link
Contributor

@THPubs THPubs commented May 13, 2016

Hi, I just ran into a small issue when using mantra-cli. Hope I can help to solve it :-)

I work with a small team. Recently, my team mate generated a new model and added some code. He pushed his work to the repo. I pulled it and tried to add a new container to the module he created. I got some errors. After trying for some time I realized that the containers folder is missing. Since it's empty, it didn't get pushed to the repo. So, when I pulled, I didn't got that folder. I had to manually create it.

But if we add a empty file in the folder, it will get pushed to the repo. So, I added a empty file called .gitkeep (A standard practice) to the folders. Hope this is a good idea :-)

@sungwoncho
Copy link

sungwoncho commented May 14, 2016

Hi, this seems like a reasonable solution.

I think if we use outputFileSync from fs-extra module in this line, there is no need for .gitkeep files. Note that we already do this when generating test files (see here).

I prefer the above approach because although .gitkeep is a widely accepted convention, it is not a standard. But I am open to other opinions. Posted on the forum for further discussion: https://talk.mantrajs.com/t/gitkeep-file-necessary-for-mantra-cli/227

@THPubs
Copy link
Contributor Author

THPubs commented May 14, 2016

Just updated with the mkdirsSync method from fs-extra. It looks much better now.

@sungwoncho
Copy link

Thanks. I don't think this fix will work. createDir already uses mkdirsSync (see here). I think we need to change this line as per my previous comment.

Please let me know if you have other suggestions.

@THPubs
Copy link
Contributor Author

THPubs commented May 27, 2016

Ah now I got it! Just reverted the changes and updated the utils.js to use outputFileSync.

@sungwoncho sungwoncho merged commit 173645b into mantrajs:master May 28, 2016
@THPubs
Copy link
Contributor Author

THPubs commented May 29, 2016

Thanks for the merge :-)

@sungwoncho
Copy link

Released in v0.3.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants