DEV Community

Cover image for palpatine supports config file in JSON format
Batuhan Ipci
Batuhan Ipci

Posted on • Updated on

palpatine supports config file in JSON format

Reflection

Over the last 5 weeks I have been slowly adding new features to my static site generator palpatine. This week too palpatine got a new feature. However, not just that, this week I also learned more interesting features that GitHub has to offer: using tracking branches and testing via remotes. Even though I have been using GitHub for about a year now, I had no idea about tracking branches and remotes. This was very interesting but something that also took me a little while to develop the muscle memory to type out intuitively.

Constant Collaboration

This week there were a lot of collaborative efforts between me and my lab partner. Our task was to add a –config feature so that the users can specify all their SSG options in a JSON formatted configuration file instead of having to pass them as command line arguments. For example, consider the following config file, ./ssg-config.json:

{
  "input": "./site",
  "output": "./build",
  "stylesheet": "https://cdn.jsdelivr.net/npm/water.css@2/out/water.css",
  "lang": "tr"
}
Enter fullscreen mode Exit fullscreen mode

I worked on my partner’s static site generator, rwar, to implement this feature and she worked on my static site generator – palpatine. I was easily able to do this in rwar which is written in Python. However, I realized that this feature was much harder to implement on palpatine which is written in C++. Samina reached out multiple times seeking help for the broken Cmake configurations and for helping in integrating the nlohmann/json library.

Creating a Draft Pull Request

Until now, I had only worked with pull requests but never with draft pull requests. After forking the repo and creating a branch to push all my changes in, I created a draft pull request. I added all commits here until the feature was complete and marked it as ready to review for the repo owner.

Git Fetch and Tracking Branches

While I was creating a draft pull request for the --config feature for rwar - I had the same done for me. When the --config feature was ready for review for palpatine. I did the following steps:

$ git remote add <name-of-remote> <https://git-url-of-other-student-fork.git>
Enter fullscreen mode Exit fullscreen mode

Then....

$ git fetch <name-of-remote>
Enter fullscreen mode Exit fullscreen mode

The fetch was done to get the latest changes from the remote repo.
In order to update the local tracking branch in the process to see any changes being made we can always do this:

$ git checkout <issue-name>
$ git pull <name-of-remote> <issue-name>
Enter fullscreen mode Exit fullscreen mode

After my review when all changes were satisfactorily done, I merged the work to my main branch and this automatically closed the pull request.

For Next Time...

I am sure there are lots of opportunities down the road for me to use tracking branches and remotes. My current focus is really on contributing as much as I can to Hacktoberfest and use some of my newly learned GitHub skills there.

Useful Links

Top comments (0)