[medium] How I automated my job with Node.js

Soure: https://medium.com/dailyjs/how-i-automated-my-job-with-node-js-94bf4e423017

You know those tedious tasks you have to do at work: Updating configuration files, copying and pasting files, updating Jira tickets.
Time adds up after a while. This was very much the case when I worked for an online games company back in 2016. The job could be very rewarding at times when I had to build configurable templates for games, but about 70% of my time was spent on making copies of those templates and deploying re-skinned implementations.

What is a Reskin?
The definition of a reskin at the company was using the same game mechanics, screens and positioning of elements, but changing the visual aesthetics such as colour and assets. So in the context of a simple game like ‘Rock Paper Scissors’, we would create a template with basic assets like below.

But when we create a reskin of this, we would use different assets and the game would still work. If you look at games like Candy Crush or Angry Birds, you’ll find that they have many varieties of the same game. Usually Halloween, Christmas or Easter releases. From a business perspective it makes perfect sense. Now… back to our implementation. Each of our games would share the same bundled JavaScript file, and load in a JSON file that had different content and asset paths. The result?

Me and the other developers had stacked daily schedules, and my first thought was, ‘a lot of this could be automated.’ Whenever I created a new game, I had to carry out these steps:

  1. Do a git pull on the templates repository to make sure they were up to date;
  2. Create a new branch — identified by the Jira ticket ID — from the master branch;
  3. Make a copy of the template I needed to build;
  4. Run gulp;
  5. Update the content in a config.json file. This would involve asset paths, headings and paragraphs as well as data service requests;
  6. Build locally and check content matched the stakeholder’s word document. Yeah I know;
  7. Verify with the designers they are happy with how it looks;
  8. Merge to master branch and move on to the next one;
  9. Update the status of the Jira ticket and leave a comment for the stakeholders involved;
  10. Rinse and repeat.

Automating with Node.js:
  • Colour Print: http://amzn.eu/aA0cSnu
  • Kindle: http://amzn.eu/dVSykv1
  • Kobo: https://www.kobo.com/gb/en/ebook/automating-with-node-js
  • Leanpub: https://leanpub.com/automatingwithnodejs
  • Google Play: https://play.google.com/store/books/details?id=9QFgDwAAQBAJ