Question about git checkins to working code


I am trying to add some static images to the project. This is a folder full of images, so I don’t want to add these to the data slots or sheets, because that would be very cumbersome. Instead, I want to just add them to the src/images folder.

I went ahead and added the folder to the Works In Progress project folder, and added to git using
git add .
git commit -m “added files”

But when I export the code, the files don’t make it to the Exported Projects folder.

I think this is because RS doesn’t refer to the actual works in progress folder when exporting code, but only to the project in memory or in the rsproj file.

How can I add these files to the rsproj file itself? The reason I want to add them to the project itself is so that I can test with them easily. Right now, I have to export the code, add the folder again, and then test my code.

One way I’ve figured out how to make life easier for me while testing is to use git post-commit hooks.

I’m still figuring it out, but basically, the post-commit hook should run every time React Studio checks in code to the Exported Project folder, and should copy my files to the relevant folder.

However, it would still be easier if the files can just be a part of the rsproj so I can more easily test them.

I have trouble adding custom things in like this as well but slightly different use cases. I have a couple SDKs, analytics tags, and a stripe payment gateway button that I add in after I export each time and in-between production. Whenever I add anything to the source folder it seems to get overwritten each time and I haven’t had much success with the script editor yet. I am in the process learning how to create plugins and create react template settings at the moment to try and alleviate this. Help videos and examples aren’t as strong here as some other things. So it’s slow going.

You should certainly look into git post-commit hook to add all those files and code. I think you can even create some sort of git patch which will apply on the same files over and over whenever you check-in…

Yea this is something that I need to have in place for sure. I will try this out this week and will try to post an update regarding my experience. Thanks for sharing!

Currently exporting overwrites existing folder so you need to use some workaround, like the mentioned git post-commit hook. We are going to improve this in the near future so that you get better control over what gets exported from Studio.


Thanks for the update @juha_neonto - we really appreciate it. I still haven’t found the time to try this one out yet.